How can I better study memory leak in NetBeans

I am writing a web. It works well, except it seems to be a memory leak. The program will work fine for about 15 minutes, and then it will fail.

If I track it using the Profile function in NetBeans, I see that the memory increases over time, until in the end I get java.lang.OutOfMemoryError and the program will work completely.

The following figure shows the memory snapshots of objects used after one minute and after 15 minutes (before the crash.) Can I indicate where these objects (my main culprits are byte[] and char[] ) or that they still refer to them (and to prevent their destruction by the garbage collector)?

Or do I have no idea what I'm talking about?

alt text

Thank you, I appreciate the help.

+4
source share
2 answers

Most likely, you are right in your way, but perhaps you are not using the right tool?

I do not know NetBeans, but I know that both Yourkit Profiler and JProfiler are very powerful tools for such analyzes. You can go into a bunch and analyze the hot spots. Both tools have a trial license, so you can try them to find out which one is right for you.

+2
source

When you use the profiler to analyze memory, you can enable recording of stack traces to allocate an object.

When launched in this mode, you can right-click on the class and display the trace of the stack (s) where the objects are created. This should give you enough information to track memory leaks.

You can also read this article: http://netbeans.org/community/magazine/html/04/profiler.html

+1
source

All Articles