Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java - can we do our own memory management?

Is it possible to perform the memory management by yourself. e.g. We allocate a chunk of memory outside the heap space so that it is not subject to GC. And we ourselves take care of allocation/deallocation of objects from this chunk of memory.

Some people have pointed to frameworks like Jmalloc/EHcache. Actually i more want to understand that how they actually do it.

I am fine with some direct approach or even some indirect approach ( e.g. first serialize java objects).

like image 717
MoveFast Avatar asked Dec 13 '22 03:12

MoveFast


1 Answers

You can not allocate Java objects in a foreign memory location, but you can map memory which is e.g. allocated in a native library into a direct ByteBuffer to use it from Java code.

like image 86
Neet Avatar answered Jan 04 '23 22:01

Neet