question about Unsafe.allocateInstance

Li Li fancyerii at
Fri Dec 23 11:14:14 UTC 2011

hi all,
     I want to allocate and free memory as c/c++ language and I found the
Unsafe in hotspot vm. I know the danger of using this class. But I still
want to try it.
     allocateMemory and freeMemory are hard to use because I can't deal
with primitive types such as int long and need convert them to byte arrays.
     And I also find a method named allocateInstance, which seems what I
want. it just allocate space for this object. I don't know the memory is in
heap or direct memory. if it's in direct memory, it should exist a method
like freeInstance, but I don't find such one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
hotspot-gc-use mailing list
hotspot-gc-use at

More information about the hotspot-gc-dev mailing list