You 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.
Now 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++.
> 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.
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?