문제

Is it possible to write memory management layer(like dlmalloc()) over sun.misc.Unsafe (allocateMemory() and freeMemory())?
I want to use off-heap storage as cache layer for faster access and want to get rid of GC overheads.
Please correct me if i am not on the right path.

도움이 되었습니까?

해결책

I suggest you have a look at https://github.com/OpenHFT/Java-Lang which has support for this, including locking in native memory. It also support 64-bit allocation sizes.

I suspect it won't be faster, or much slower, but the benefit is control over memory layout for cache friendliness, no object headers and no GC pauses.

You might also be interested in https://github.com/OpenHFT/Java-Chronicle which supports persisted off heap memory which can be shared between processes.

Both have been released to maven central http://central.maven.org/maven2/net/openhft/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top