Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you diagnose a leak in C memory caused by a Java program?

I'm working on a large application (300K LOC) that is causing a memory leak in the Sun 1.6 JVM (1.6_05). Profiling the Java shows no leak. Are there any diagnostics available from the JVM that might detect the cause of the leak?
I haven't been able to create a simple, isolated Java test case. Is the only way to figure this out by using a C heap analyzer on the JVM?
The application creates a pool of sockets and does a significant amount of network I/O.

like image 562
David G Avatar asked Sep 20 '08 12:09

David G


1 Answers

Some profiler like profiler4j can show the managed and the unmanaged memory (live curve). Then you can see if you has a leak and when the leak occur. But you does not find more informations.

After this there are 2 possible solutions:

  1. You can with the live curve isolate the problem and create a simpler test until you have find the cause of the problem.
  2. You search your code for the typical problems like:
    1. Instances of the class Thread that are never start.
    2. Images or Graphics that never are dispose
    3. ODBC Bridge Objects that are never close
like image 112
Horcrux7 Avatar answered Oct 18 '22 13:10

Horcrux7