state the complex reallocation procedure some


State the complex reallocation procedure

Some languages provide arrays whose sizes are established at run-time and can change during execution. These dynamic arrays have an initial size used as basis for allocating a segment of memory for element storage. Afterwards array may shrink or grow. If array shrinks during execution, then only an initial portion of allocated memory is used. Though if array grows beyond the space allocated for it, a more complex reallocation procedure must occur, as follows:

1.  A new segment of memory large enough to store the elements of expanded array is allocated.

2.  All elements of the original (unexpanded) array are copied into new memory segment.

3.  The memory used initially to store array values is freed and newly allocated memory is associated with the array variable or reference.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: state the complex reallocation procedure some
Reference No:- TGS0356374

Expected delivery within 24 Hours