简体   繁体   中英

Is it possible to allocate and free memory space for a Java Object off-heap?

If so please provide an example and also how to free the memory once created.

I imagine it might be possible using the Unsafe instance?

You are probably looking for a Pool object.

Essentially - going off-heap is complex and system-dependent. However, if you pre-allocate a pool of objects you can take them and return them atomically. It would certainly ensure a more fixed and predictable latency but it would not guarantee it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM