Is it possible under any circumstances for a leak in a Java application, for instance a Tomcat servlet app, to exceed the allocated memory and use additional system memory, or is the allocated heap for the JVM truly firewalled (so to speak) from the (rest of the) OS/Kernel memory? I am working in 2.6 Kernel Linux with Java 6 and 7, but this is more of a general question.
Asked
Active
Viewed 359 times
3
-
Yes. There are a number of ways that the JVM can consume memory other than via the Java heap. For example, by default every thread takes 2Mb for its stack. If you describe the problems that you're seeing, perhaps someone will help you resolve them. – kdgregory Apr 04 '14 at 19:20
-
This is more of a general question really. I was on a conference call with some Java developers, and I suggested a memory leak could potentially eat system memory beyond the heap, and the senior developer on the project told me that was impossible. I disagree that it is impossible, but I don't know the specifics, I believe I have seen it happen in the past. – GL2014 Apr 04 '14 at 19:26
2 Answers
3
Yes - it's possible. Java memory area is divided into few regions - heap and permgen are not all of them. There are also areas for code cache and native memory, which is quite popular for all of-heap structures. Please take a look at slide 7 of this presentation

Jakub Kubrynski
- 13,724
- 6
- 60
- 85
2
Of course, it is possible. Simple examples are ByteBuffer.allocateDirect()
and FileChannel.map()
. The contents of such buffers is out of Java Heap.

apangin
- 92,924
- 10
- 193
- 247