LEGO Mindstorms EV3 |
When "create array" is called - memory is allocated using "malloc" for the descriptor and the array itself. The memory pointer is stored in a list specific to every program. The returned handle is simply the index in that tabel.
When a program is terminated the memory is automatically freed.
Slot 1 Array 1 --------- ---------- HANDLE -> pARRAY1 -> DESCRIPTOR Element 0 Element 1 - - - - - Element n If an array needs to be resized it just uses "realloc".