Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Java heap space out of memory error
Java heap space out of memory error [message #334271] Fri, 30 January 2009 07:46 Go to next message
Sharon F is currently offline Sharon FFriend
Messages: 8
Registered: July 2009
Junior Member
Hi All,
I have a plugin handling data for a specific type of files. The plugin
loads data from a file into a data module, then creates a multipage editor
to display and edit the data module, and finally writes data back to the
file.
The data module is created thru a factory class's getInstance(File
editingFile) static method, which enables the plugin to edit mulitiple
files at the same time. Inside the factory class, a static HashMap is used
to keep track of each java.io.File object and its corresponding data
module.
The plugin works just fine until when tests it with a fairly big file:
open the big file and then close it immediately for several times, a java
heap space out of memory error occurs.
With Java VisualVM, I found the plugin keeps about 8M heap memory
unreleased after being closed. I tried every way to solve it but could
not: it seems to me that all the widgets have been disposed, the data
module has been removed from the factory class.
Any ideas? Or is there any tool can help me to find who stays in the heap
not cleaned up?

Thanks in advance!

Sharon
--
http://www.eclaxy.com
Re: Java heap space out of memory error [message #334272 is a reply to message #334271] Fri, 30 January 2009 08:21 Go to previous messageGo to next message
Jens  übler is currently offline Jens üblerFriend
Messages: 17
Registered: July 2009
Junior Member
Sharon schrieb:
> Hi All,
> I have a plugin handling data for a specific type of files. The
> plugin loads data from a file into a data module, then creates a
> multipage editor to display and edit the data module, and finally writes
> data back to the file. The data module is created thru a factory
> class's getInstance(File editingFile) static method, which enables the
> plugin to edit mulitiple files at the same time. Inside the factory
> class, a static HashMap is used to keep track of each java.io.File
> object and its corresponding data module.
> The plugin works just fine until when tests it with a fairly big
> file: open the big file and then close it immediately for several times,
> a java heap space out of memory error occurs.
> With Java VisualVM, I found the plugin keeps about 8M heap memory
> unreleased after being closed. I tried every way to solve it but could
> not: it seems to me that all the widgets have been disposed, the data
> module has been removed from the factory class.
> Any ideas? Or is there any tool can help me to find who stays in the
> heap not cleaned up?
>
> Thanks in advance!
>
> Sharon
> --
> http://www.eclaxy.com
>
>

Try to profile your project by using Eclipse TPTP or use JProfiler.
These tools offer memory analysis so you can pin down what exactly stays
in memory.

Jens
Re: Java heap space out of memory error [message #334289 is a reply to message #334271] Fri, 30 January 2009 21:46 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Sharon" <sharon.floyd@eclaxy.com> wrote in message
news:d9fd030cf8e55a74e7d14bbdca55cba5$1@www.eclipse.org...
> The data module is created thru a factory class's getInstance(File
> editingFile) static method, which enables the plugin to edit mulitiple
> files at the same time. Inside the factory class, a static HashMap is used
> to keep track of each java.io.File object and its corresponding data
> module.

Just to check: you are removing the entry from that map, when the file is
closed, right?

I've found that whenever using these sort of static maps that track dynamic
data it is very important to think about the references. Sometimes it helps
to have it be a Map<File, WeakReference<Thing>> rather than just a Map<File,
Thing>, so that there isn't a circular reference that prevents the Thing
from ever actually being released.
Previous Topic:Automatically activate 'problems' view when errors occur in compilation
Next Topic:IOConsole Updater (Time of error: <timestamp>)
Goto Forum:
  


Current Time: Fri Apr 26 10:33:49 GMT 2024

Powered by FUDForum. Page generated in 0.03441 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top