DirectByteBuffer, native memory and system.gc
MicheleCalcavecchia 270000HCF1 Comment (1) Visits (11409)
The default behavior for DirectByteBuffer is that 64 MB of memory is reserved at startup for direct byte buffers. The buffers are then allocated out of the reserved space. If a request for a buffer is made, and there is not sufficient space to satisfy the allocation, then a call to system.gc is made in order to free up any buffers that are no longer in use. If, after the system gc, there is still insufficient memory to satisfy the allocation, then the reserved space is expanded by 32Mb.
This behavior can be overridden with the -XX: