3 ms·
> What makes a difference is gc pauses. Imho if you can live without managed memory. You can do this in java as well and eliminate gc pauses. Wait, how can yo
by jrochkind1 13y ago
> What makes a difference is gc pauses. Imho if you can live without managed memory. You can do this in java as well and eliminate gc pauses.
Wait, how can you turn off GC'd managed memory in Java, and do it yourself? I didn't know you could do that in Java?
- pron 13y agoYou don't turn it off, but you can use off-heap memory (with direct ByteBuffers) and manage it yourself. Some Java applications manage some part of their memory off-heap, but this is a bad idea unless the allocated objects have a well-defined lifecycle.
- russfrank 13y agohttp://stackoverflow.com/questions/9323416/using-memory-allocated-by-sun-misc-unsafe-allocatememory-in-native-code http://stackoverflow.com/questions/9323416/using-memory-allo...
- jamii 13y agoYou can even write c-like structs over byte-buffers - https://github.com/ztellman/vertigo https://github.com/ztellman/vertigo
- _pmf_ 13y agoSame for plain Java instead of Clojure: http://javolution.org/target/site/apidocs/javolution/io/Struct.html http://javolution.org/target/site/apidocs/javolution/io/Stru...
- fauigerzigerk 13y agoNow everyone will tell you that you can use ByteBuffer or sun.misc.Unsafe to keep memory off-heap and hence out of sight of the GC. BUT what that means is that you have create your own custom implementations of the data structures you need and you'll have to write your own memory allocator. Unless that memory area holds just a simple data BLOB (like a video file) you're always going to be much more productive implementing the entire thing in C++.
- pjmlp 13y ago> Unless that memory area holds just a simple data BLOB (like a video file) you're always going to be much more productive implementing the entire thing in C++. Or use a GC enabled systems programming language, that provides control over what is allocated via GC or via other means.