Is it possible for a Java memory leak to use more

2020-04-12 09:51发布

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.

2条回答
ら.Afraid
2楼-- · 2020-04-12 10:12

Of course, it is possible. Simple examples are ByteBuffer.allocateDirect() and FileChannel.map(). The contents of such buffers is out of Java Heap.

查看更多
小情绪 Triste *
3楼-- · 2020-04-12 10:24

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

查看更多
登录 后发表回答