3 ms·
In fact, "to bypass GC completely" is impossible because you still need on-heap objects to access the off-heap stuffs. Note, there is always "no magic".
by jinmingjian 12y ago
In fact, "to bypass GC completely" is impossible because you still need on-heap objects to access the off-heap stuffs. Note, there is always "no magic".
- chii 12y agobut the on-heap references you keep are only going to be much smaller and thus, alleviate a lot of gc. Offheap storage tend to be things like caching, and caching in java does incur gc costs that you avoid with off-heap stores. It's not a bad solution.
- jkot 12y agoIt is possible to program in java without allocating GC at all. (if you do not count class loader and some other system stuff). Use Unsafe and primitive (on stack) variables. Peter has some nice demos on his blog.