NIO.2 and GC fragmentation

Leon Finker leonfin at optonline.net
Sun Jan 18 09:30:03 PST 2009


Hi,

While at it, I decided to comment on the other half of the problem that
existed in early .NET versions and sockets API: GC fragmentation. When
calling out to OS native API, the buffers that we pass in from .NET world
are "pinned" and used directly by the underlying OS native API. What this
means is that GC is unable to move these buffers around in order to compact
the heap until native API returns to managed world. Since on a server
thousands of buffers can be pinned while waiting for I/O to happen this
caused a great deal of heap fragmentation. 

Is it correct to assume that Java in a sense also "pins" the Java direct
buffers that it uses in JNI and those prevents GC from moving these buffers
and compacting the heap until native API returns? Thank you in advance for
feedback




More information about the nio-discuss mailing list