<b>please I'm having a problem understanding how data is transferred from disk to memory is conducted under programmed I/O. Can anyone help explain to me with examples the steps involved in this type of data transfer. Thanks.</b>
Suppose any reference type is stored in some memory location and its data is continuously expanding for example appending string in loop in StringBuilder.
How memory manager manages the scenario when its object doesnt has contiguous memory available at that location.
It would be great if any one can explain it in detail.
It just gets moved to a block of memory that is large enough to hold the expanded object. This is why you should always try to estimate how big your objects are likely to grow and reserve enough space, to minimise these operations.
Beyond Richard's answer, note that you can run into an OutOfMemoryException when no contiguous block of the desired size is available, i.e. when the memory is fragmented. Also, the desired size is in multiples of 64k.