Diagnosing out of memory errors

I'm working on a project that uses a number of applets on different HTML pages. I'm seeing "OutOfMemroy" errors after long periods of use on a Linux Mozilla Firefox client using Java 1.6.0. I have attempted to analyze the jmap heap dump, and it seems like many character arrays, byte arrays, and integer arrays are being kept in memory even after garbage collection has taken place (on the order of 50 MB of such data). This amount continues to grow as the user navigates from page to page. I've tried increasing the heap size to 512 MB in the hopes that this will "peak out", but it just keeps growing. Has anyone else experienced this kind of problem with pages containing applets? Does anyone know of any tools that can get more helpful information than the heap dump? I'm struggling to understand why these arrays are kept around even after the applets are destroyed. Thanks in advance for any help.

--Nathan

[930 byte] By [nathan.michael.rosea] at [2007-11-14]
# 1

All memory problems like that are caused by the accumulation of objects in the head that are being continually created, used and then "forgotten". The rule of thumb is: delete all references to an object is it's not needed anymore, so that garbage collector knows that it's not needed. In many cases it's caused by objects being added to an array or collection and never removed when not needed.

The best tools for troubleshooting these problems are commercial profilers like JProbe. They allow you to inspect the heap contents, take snapshots and then compare those snapshots. The increased number of objects over a specific period of time means that there might be a memory leak. Profilers will tel you what is class name for such objects and that is usually good clue to start looking at the code that uses these classes to find the leak.

Faustas

http://www.faustas.com

Faustasa at 2007-7-9 > top of java,Core,Monitoring & Management...