views:

35

answers:

6

I'm trying to find a memory leak in an old Java 1.4 application. I have tried to use jmp but unfortunately I've had no luck getting it working (is it actually supported in Windows 7?).

If anyone knows of any free/open source Java 1.4 memory profilers that definitely work on Windows 7 64-bit, please let me know.

A: 

You're running on a 1.4 JVM, correct? It's not a 1.4-compiled class running on a 1.6 JVM? And is there a reason that you can't run the application on a 1.6 JVM, at least in a development environment?

If not, the built-in HProf agent should work, at least to find a memory leak. It will tell you what objects are live when you kill your program, and where they were allocated.

I'm not 100% certain, but I believe that you need to use the -Xrunhprof invocation option (the linked doc invokes with -agentlib, which I think may have been added in 1.5). Also, I think there was a version of 1.4 that supported the "modern" debug interface, so could be used with JConsole.

Anon
It's 1.4 JDK running on 1.5 JRE.
nbolton
@nbolton - that makes no sense. Do you mean that you *compiled* using a 1.4 JDK and are *running* on a 1.5 JRE? In that case, you can use whatever profiler you like, as long as it works with a 1.5 JRE (and to the best of my knowledge, that includes everything out there). If you are having problems connecting to a 1.5 JRE, start examining your system components and your assumptions; one of them is not what you think it is.
Anon
Wow, talk about being pedantic. Of course I meant that...
nbolton
@nbolton - sorry, my crystal ball is out for repair. I hope the downvote felt good for you too.
Anon
A: 

SAP has contributed a memory analyzer to eclipse which gives very nice and elaborate reports. check the below link

http://www.eclipse.org/mat/

keshav.veerapaneni
A: 

I used JMP until we moved to Java 1.6.

http://www.khelekore.org/jmp/

GCViewer is nice if you're just verifying leaks:

http://www.tagtraum.com/gcviewer.html

Steve Jackson
A: 

Did you already try

jps -l
jmap -histo <pid>

And then, I would install Java 6, run the same application, and use:

jconsole
Thomas Mueller
A: 

I have used YourKit Java profiler http://www.yourkit.com .

Daniel Voina
A: 

I ended up doing the following:

  1. Add the -XX:HeapDumpPath=C:\Temp\HeapDump argument when starting the app
  2. Wait until it crashes with OutOfMemory exception
  3. Use Memory Analyzer (MAT) to see what was using so much memory.
nbolton