This discussion is archived
4 Replies Latest reply: Apr 24, 2013 10:26 PM by 914264 RSS

How to quickly and accurately find out the memory leak points?

914264 Newbie
Currently Being Moderated
Hi, all.I have added a option -XX:+HeapDumpOnOutOfMemoryError in the bootstarp script of my application.
The application has been run for one day and the OOM error was thrown again. So I downloaded the hprof file and used MAT to parse it.
But after seeing the leak suspects I still have no idea what's wrong and what's the possible leak point.
Can anyone shard some experience how to find out the memory leak points quickly and accurately?
It would be more nice if you can take a loot at the leak supects.

Thanks,
SuoNayi
  • 1. Re: How to quickly and accurately find out the memory leak points?
    914264 Newbie
    Currently Being Moderated
    The Java version is the following,
    -------------------------------------------------------------
    java version "1.5.0_16"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_16-b02, mixed mode)
    -------------------------------------------------------------
  • 2. Re: How to quickly and accurately find out the memory leak points?
    914264 Newbie
    Currently Being Moderated
    Furthermore, when I try to dump the thread stack, I can see the following errors/warns:
    ---------------------------------------------------------
    Thread 12135: (state = BLOCKED)
    - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
    Error occurred during stack walking:
    sun.jvm.hotspot.utilities.AssertionFailure: Only used on C2 x86
         at sun.jvm.hotspot.utilities.Assert.that(Assert.java:15)
         at sun.jvm.hotspot.code.CodeBlob.getLinkOffset(CodeBlob.java:193)
         at sun.jvm.hotspot.runtime.amd64.AMD64Frame.senderForCompiledFrame(AMD64Frame.java:297)
         at sun.jvm.hotspot.runtime.amd64.AMD64Frame.sender(AMD64Frame.java:213)
         at sun.jvm.hotspot.runtime.Frame.sender(Frame.java:184)
         at sun.jvm.hotspot.runtime.Frame.realSender(Frame.java:189)
         at sun.jvm.hotspot.runtime.VFrame.sender(VFrame.java:102)
         at sun.jvm.hotspot.runtime.VFrame.javaSender(VFrame.java:129)
         at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
         at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
         at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
         at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
  • 3. Re: How to quickly and accurately find out the memory leak points?
    gimbal2 Guru
    Currently Being Moderated
    Can anyone shard some experience how to find out the memory leak points quickly and accurately?
    There is no such thing. This is the moment where you realize that programming is incredibly hard and this is also the moment where you prove that you are better than the thousands of other Java developers competing for your job position. It takes good reasoning skills to root out these kind of problems, and probably lots of time and experimentation.

    But first update to Java 5 update 22 (if you must stick with an unsupported version of Java) to see if that doesn't magically solve the issues you have. It would be a terrible shame if you were investing huge amounts of time into researching something caused by the fact that you're running a version of Java with a bug that has been fixed looooong ago.
  • 4. Re: How to quickly and accurately find out the memory leak points?
    914264 Newbie
    Currently Being Moderated
    After reviewing the leak suspects carefully and composedly,I find the best solution has been provided by MAT.
    It's really a good toolkit to profile the OOM problem.
    Thanks for your comment and it drives me to dig the problem more deeply.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points