Additionally, you have the barely-documented but nasty behavior of Hotspot forcing full GCs when allocateDirect reaches -XX:MaxDirectMemorySize.
On Sun, Nov 13, 2011 at 2:09 PM, Peter Schuller <peter.schul...@infidyne.com> wrote: >> I would like to know it also - actually is should be similar, plus there are >> no dependencies to sun.misc packages. > > I don't remember the discussion, but I assume the reason is that > allocateDirect() is not freeable except by waiting for soft ref > counting. This is enforced by the API in order to enable safe use of > allocated memory without it being possible to use to break out of the > JVM sandbox. > > JNA or misc.unsafe allows explicit freeing (at the cost of application > bugs maybe segfaulting the JVM or causing other side-effects; i.e., > breaking out of the managed runtime sandbox). > > -- > / Peter Schuller (@scode, http://worldmodscode.wordpress.com) > -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com