Friday, January 8, 2010

Working on a memory leak

It's interesting that this should come up since Java handles garbage collection(memory is automatically returned to the VM) but I have a few suspicions as to why the leak is occuring.  I'm using Launch4J to create an EXE file for my program.  It's convienent because it makes it easy for Windows users who recognize an Exe file.  Surprisingly, Memory usage shoots up.  Sometimes the VM would require 100MB of memory, even though that wasn't the real usage (VM sets aside memory it thinks it will need).  In fact when I profiled iTunesDSM within Netbeans most of the time the memory required was only around 14-35mb(depending on whether the gui was visible-not disposed).  Well after running iTunesDSM.exe in the background for most of the morning, the memory required had ballooned to 245MB.  Totally unacceptable.  So experiments abound.

When running the iTunesDSM.jar file that the Exe file references, memory usage(before gui) was hovering around 15mb.  Not bad, espicially since background monitoring was starting.  Start the gui and it jumps to 45mb not bad.  So is it Launch4J or background monitoring.  I'm taking out the Launch4J first and experimenting.  I'll report back later.


UPDATE:  It's not Launch4J.  It seems to be in the FolderWatcher class.

No comments:

Post a Comment