I recently spent a day profiling an application that I am responsible for at work. The reason I began this little exercise was that I noticed that the application started off using about 5MB of heap after initialisation. If left to its own devices, with zero request throughput, the heap usage rose to 90% and then hovered between 80% and 90% indefinitely. Must be a memory leak, I said to myself.

I used OptimizeIT to profile the heap, and discovered that there were no objects being created and held that might contribute to the memory leakage.

After a day of wasted effort, I discovered that using "-server" to set the hotspot VM to server mode cured the problem entirely. The heap usage sat at around 5 - 6MB indefinitely. Apparently, when garbage collection is performed, memory is only freed until a certain threshold is reached. After that, the client VM decides that's enough until the high water mark is reached once more.

The moral of the story is that not all memory consumption is leakage.

Cheers

ADK

Noel J. Bergman wrote:

Jason,

Most of my earlier work was from SMTPHandler into the spooler. It is
certainly possible that we have more work to do. Possibly more
opportunities for object pooling, too.

Some useful references:

Heap Analysis Tool: http://java.sun.com/people/billf/heap/
(also follow links from this page)
http://www.javaworld.com/javaworld/jw-12-2001/jw-1207-hprof.html
http://tutorials.findtutorials.com/read/id/213

--- Noel

-----Original Message-----
From: Jason Webb [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 10:15
To: 'James Developers List'
Subject: RE: Memory leaks in RemoteDelivery mailet?


-----Original Message-----
From: Noel J. Bergman [mailto:[EMAIL PROTECTED]]
Sent: 03 February 2003 15:04
To: James Developers List
Subject: RE: Memory leaks in RemoteDelivery mailet?


Jason,

Are you familar with the heap profiler in Sun JVM? Seems
like we may have a bit more work to do in other parts of
James. It would help to identify which objects are growing.


No I'm not. But I'm willing to try...
The reason I thought the gc log was relevant as if I use the null mailet
I get steady-state memory usage, but when using the remote delivery
mailet I get issues with this memory creep. I'm also running NuMega
DevPartnet for Java (eval copy) to see if that helps find the problem.

--- Noel

-----Original Message-----
From: Jason Webb [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 9:21
To: James Developers List
Subject: Memory leaks in RemoteDelivery mailet?


I've been doing some testing with 2.1 (jdk 1.4.1, Javamail
1.3) under Win2k.

I've constructed a testing that sends 5 mails/sec into James.
The messages are destined for another remote server (relay).
Running the VM with -Xloggc on there is a slow and persitant
memory leak.

James is keeping up with the incoming mail volume quite
easily. Even when I stop the incoming mail, the memory still
persists (and is never freed). Lacing the code with periodic
GC's never frees the memory either.

Any suggestions?

-- Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to