This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 51769 - Out of Memory
Summary: Out of Memory
Status: CLOSED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords: PERFORMANCE
Depends on: 52286
Blocks:
  Show dependency tree
 
Reported: 2004-11-23 17:49 UTC by demareg
Modified: 2006-03-24 09:55 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE Log file showing memory exceptions (128.56 KB, text/plain)
2004-11-23 17:51 UTC, demareg
Details
Log file showing Out Of Memory Error in 4.1EA1 (28.82 KB, text/plain)
2004-12-05 23:40 UTC, demareg
Details
traces to FormDesigner from roots (6.78 KB, text/plain)
2004-12-09 16:13 UTC, _ rkubacki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description demareg 2004-11-23 17:49:14 UTC
Get Out of Memory exception after editing and
testing for a few hours.
Comment 1 demareg 2004-11-23 17:51:18 UTC
Created attachment 19010 [details]
IDE Log file showing memory exceptions
Comment 2 demareg 2004-11-25 00:58:52 UTC
The problem has gotten worse as the code has gotten bigger.  Now,
within 15 minutes, the editor and my whole system slows down and
within 30 minutes, I get the Out Of Memory exception.  After the first
use of the editor provided list of object methods etc, java.exe starts
using 99% of the CPU time.  This usage continues until and after the
Out Of Memory exception (often during a compile).  On one occasion,
the slow down was so severe that I couldn't even get the XP task
manager up and had to reboot the system (and lost the changes that I
had made).
Comment 3 Marek Grummich 2004-11-30 09:12:11 UTC
Try to the latest Netbeans 4.0 RC (RC 2 available at the end of this
week), some improvements were integrated. If you encounetered a
problem again, feel free to reopen the issue and attach relevant
information (steps, ide log). Thanks!
Comment 4 demareg 2004-12-05 23:40:31 UTC
Created attachment 19149 [details]
Log file showing Out Of Memory Error in 4.1EA1
Comment 5 demareg 2004-12-05 23:43:49 UTC
The out of memory problem re-occurred on the next version  of
netbeans.  The problem of stalling the computer was not experienced,
but the Out Of Memory occurred within half an hour of start of editing
of the long program.
Comment 6 _ rkubacki 2004-12-06 08:45:20 UTC
Can you be more specific what activity causes the problem? To identify
the source we would need to know what part should be responsible -
editing (what files?), execution, debugging and so on. You can turn on
memory toolbar to track current heap usage.

For a large project you can tune memory settings as described in 
http://performance.netbeans.org/howto/jvmswitches/index.html
Comment 7 _ rkubacki 2004-12-06 08:50:00 UTC
Also what is your hardware and OS?
Comment 8 demareg 2004-12-06 13:52:40 UTC
The operating system is Windows XP SP2.  I was editing a file - adding
code to the function ForceButton6ActionPerformed().  The file is about
4100 lines long.  The main project contains another small file and
refences another project that interfaces with a C++ DLL library.  The
code runs and tests successfully to the extent that it is completed. 
Running the code does not seem to cause the problem, it appears that
after a variable number of edits the system slows down and shortly
afterwords, if I don't exit, the Out Of Memory occurs.  I can make the
projects available for testing/debugging if requested. 
Comment 9 _ rkubacki 2004-12-06 15:16:05 UTC
Do you use form (GUI) editor?
Comment 10 demareg 2004-12-06 16:17:18 UTC
The project was built using the GUI editor, but I have not made
changes to the GUI for a while.  It created 196 swing objects and
InitComponents() is 2059 lines long.

The computer has a 1,024 MB of memory, available after XP 655.61 and
virtual memory of 2.0 GB.  Using a demo version of TaskInfo2003, I
find that only about 296,000 bytes of memory are used when the system
slows down but the number of 'handles' of 1,873 is much larger than
anything else on my computer and the CPU usage is over 97%.
Comment 11 _ rkubacki 2004-12-06 17:12:20 UTC
I suggest you to increase the limit for Java heap with -Xmx option as
desribed in linked document. This will improve overal performance on
your system.

I am reassigning the bug to form editor for further evaluation. It is
not clear yet if it is scalability problem (4100 lines is acceptable
for our Java editor but form can add significant additional overhead)
or wherther it is a leak. 
Comment 12 Jan Stola 2004-12-07 09:02:12 UTC
I doubt it has anything to do with form editor (the reporter
hasn't modified the GUI for a while). The following symptoms
point to java module => reassigning for evaluation.

> After the first use of the editor provided list of object
> methods etc, java.exe starts using 99% of the CPU time.
> This usage continues until and after the Out Of Memory
> exception (often during a compile).
Comment 13 Martin Matula 2004-12-08 15:31:46 UTC
Could you please verify this with the latest 4.0 RC build (rc2)? The
4.1ea1 is almost as old as 4.0beta2 - there have been some significant
improvement made in the memory usage in the rc2. How many classes do
you have (approximately) in your project? How many other project do
you have open in the IDE? Do you run out of memory even if you
increase the max. heap size (using -Xmx setting)?
Comment 14 demareg 2004-12-08 19:29:25 UTC
THe new version, netbeans-4.0rc2, seems to have fixed the problem.
Comment 15 _ rkubacki 2004-12-09 14:14:29 UTC
It is not fixed. There is still leak. NB trunk build from Dec 8, JDK
5.0u1-b06 and with reporter's form it retains more than megabyte after
form open, editing of source, close. I do not know if I need to edit,
maybe it does not depend on this.
Comment 16 Martin Matula 2004-12-09 14:31:57 UTC
Does this happen when editing a plain Java? Or only with forms? Does
the memory grow with opening and closing the file repeatedly, or the
increased usage of memory is a one-time thing and can be caused by the
fact that more classes get loaded when opening a form or that 2 ASTs
get cached when a file is open?
Comment 17 _ rkubacki 2004-12-09 16:12:29 UTC
I will attach some interesting traces showing various ways how the
data can be held and fill more bugs to track them separately. To
briefly comment them:

1) there is a thread keeping all top level windows to clear them on
shutdown held by TopThreadGroup, number of these windows is growing in
time and they keep some resources (including FormDesigner through
pallete). I need to investigate.

2) cell renderers holding the panel -> TC -> FormDesigner, this is
known issues of JDK that can be workarounded

3) org.netbeans.modules.editor.NbToolTip$Request listening to
org.netbeans.modules.debugger.projects.ToolTipAnnotation

4) FindDialogSupport in editor holding editor pane -> TC -> FormDesigner

5) org.netbeans.modules.form.FormLAF.ideDefaults hold another instance
of FormDesigner
Comment 18 _ rkubacki 2004-12-09 16:13:53 UTC
Created attachment 19237 [details]
traces to FormDesigner from roots
Comment 19 Martin Matula 2004-12-09 16:16:14 UTC
It seems that none of these issues have anything to do with java
module. Which module should I reassign this to?
Comment 20 Martin Matula 2004-12-10 10:25:53 UTC
Reassigning back to form, since this has nothing to do with java
module and one of the reference traces points to FormLAF.ideDefaults
(note there is a separate issue filed for the editor leak related to
this).
Comment 21 Jan Becicka 2004-12-10 12:56:51 UTC
I also have problems with out of memory error. Strange is, that memory
meter shows 100/178MB free.
Comment 22 Jan Stola 2004-12-14 09:41:06 UTC
Yes, one of the reference traces points to FormLAF.ideDefaults,
but this field is a Map that points to the same objects as UIManager's
defaults map. So, the question is how something
(NbToggleLineNumbersAction?) that holds a reference
to FormEditorSupport$JavaEditorTopComponent has been inserted
into this map. There are also other traces ending in the editor
module => reassigning to editor for evaluation.
Comment 23 _ rkubacki 2004-12-15 14:05:24 UTC
Re Honza Becicka: it can be OK. OOME can be thrown under various
circumstances. The most often one is lack of space on Java heap.
Another possibility is full permanent area or problems with parallel
GC. If there was really only 100 of 178 used than it can be very
likely permarea. What platform do you run on? We can track this
problem (perhaps in a separate issue).

re Honza Stola: it is not editor problem. The form module deeply
copies the content of map. Form maintainers should justify this. Why
form needs to keep this data?
Comment 24 Jan Becicka 2004-12-16 08:19:39 UTC
I'm using windows xp.
Comment 25 Miloslav Metelka 2004-12-20 11:37:01 UTC
According to the last Radim's note reassigning back to form for
evaluation.
Comment 26 Tomas Pavek 2005-01-04 10:18:50 UTC
We will check the suspicious traces in form as soon as possible,
together with issue 52287. These issues should be resolved for 4.1.
Comment 27 Jan Stola 2005-01-05 14:20:38 UTC
FormDesigner is no longer held in memory after fix of issue 52286 =>
closing.
Comment 28 Marek Grummich 2005-07-11 16:35:22 UTC
verified