File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Memory Leak and JVM Crash Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Memory Leak and JVM Crash " Watch "Memory Leak and JVM Crash " New topic

Memory Leak and JVM Crash

Sri Harsha Yenuganti

Joined: Mar 02, 2010
Posts: 18

I am using JNI to call some back end logic. Everything is working fine except a memory leak which is crashing the JVM after repeated runs. In one function, I am creating and returning a large "jobject" to Java code from JNI. This object is not being deleted after the return from the JNI call. The JVM is being crashed when the code tries to create the same object in the next run as the PermGen Object Space is utilized 99%. The JVM is being crashed in the GCTask thread as shown from the crash dump log files.

Here is the Memory info from the crash dump log file:

PSYoungGen total 196224K, used 78894K [0x0000002ad4070000, 0x0000002ae5e30000, 0x0000002ae95c0000)
eden space 195840K, 40% used [0x0000002ad4070000,0x0000002ad8d23870,0x0000002adffb0000)
from space 384K, 91% used [0x0000002ae04a0000,0x0000002ae04f8040,0x0000002ae0500000)
to space 48384K, 0% used [0x0000002ae2ef0000,0x0000002ae2ef0000,0x0000002ae5e30000)
PSOldGen total 524288K, used 124951K [0x0000002aa95c0000, 0x0000002ac95c0000, 0x0000002ad4070000)
object space 524288K, 23% used [0x0000002aa95c0000,0x0000002ab0fc5c80,0x0000002ac95c0000)
PSPermGen total 106688K, used 106538K [0x0000002a995c0000, 0x0000002a9fdf0000, 0x0000002aa95c0000)
object space 106688K, 99% used [0x0000002a995c0000,0x0000002a9fdca950,0x0000002a9fdf0000)

Is there any way that I can forcibly delete that local reference object manually as GC is not deleting it?

For each run I have to check if the object is there in the environment, and if if yes, I need to delete it. Is there any way that i can check if a particular object is present in the JNI env ?

How can I see all the references to that object which are blocking the object from being garbage-collected?
I agree. Here's the link:
subject: Memory Leak and JVM Crash
It's not a secret anymore!