Bug 20776

Summary: Memory leaks in text editor.
Product: [Eclipse Project] Platform Reporter: Torkild Ulvøy Resheim <torkild.resheim>
Component: UIAssignee: Nick Edgar <n.a.edgar>
Status: RESOLVED INVALID QA Contact:
Severity: major    
Priority: P2 CC: holger.klingspohr, Kevin_Haaland
Version: 2.0Keywords: performance
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Torkild Ulvøy Resheim CLA 2002-06-21 04:47:02 EDT
The javaw process used around 34Mb when I started Eclipse. After opening a 14MB
file from the resource perspective using the default text editor Eclipse used
108Mb. The memory was not freed when I closed the editor (even 10 minutes
later). When opening the same document again the process used 109Mb. Repeating
the process several times increased the consumption by about 1Mb each time.
Opening another large text file increased the consumtion to 181Mb which also was
not freed when closing the editor. Opening the same file again and the
consumption was as 223Mb.

After opening the same douments 3-4 times the memory usage did not increase any
more. It's looks like the files are kept in separate buffers which are not
emptied when the files are closed.

This behaviour was observed using the F3 release.
Comment 1 DJ Houghton CLA 2002-06-21 09:25:04 EDT
Moving to Platform/UI for comment.
Adding KH to CC since he has been doing performance work in this area.
Comment 2 Torkild Ulvøy Resheim CLA 2002-06-21 09:47:04 EDT
We'd a discussion on the NG about this. It seems like all the memory the 
editor used is freed up when Eclipse is minimized and the maximised again.
I guess this is not a bug, or just a small one. Since I'd expect Eclipse to 
free the memory the editor used as soon as the editor was closed.
To verify this I opened a lot of big files until I got a Out of Memory Error, 
I then closed the same files and opened another big file. No error occured so 
I guess the GC freed up what was previously used.
Comment 3 Nick Edgar CLA 2002-06-21 11:35:02 EDT
Interesting.  What kind of file were you opening?  A .java file or a plain text 
file?

Simply minimizing and restoring the window does not generate a garbage collect 
in the VM.  The VM GCs if needed when trying to allocate new objects, and only 
issues an OutOfMemoryError if it fails to allocate the new object even after 
GCing.  This looks like some strange interaction with the OS memory manager.
Comment 4 Torkild Ulvøy Resheim CLA 2002-06-24 05:18:20 EDT
It was a plain text file (compilation log). After reading the latest posts on 
the newgroup it seems that I'm mistaken about the memory usage. I was looking 
at the physical memory measurment, not total *doh*. Which means that 
the "memory allocation change" I was seeing simply was Windows XP putting 
Eclipse in the swap file.
Comment 5 Nick Edgar CLA 2002-07-04 11:47:58 EDT
Closing PR.  Please reopen if you still think there is a problem.