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 98168 - Autoupdate keeps too much data in memory
Summary: Autoupdate keeps too much data in memory
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Autoupdate (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: rmatous
URL:
Keywords: PERFORMANCE
Depends on: 89627 101103
Blocks:
  Show dependency tree
 
Reported: 2007-03-19 08:39 UTC by Petr Nejedly
Modified: 2007-09-21 17:20 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2007-03-19 08:39:50 UTC
Once AU connects to the AU server, it keeps the XML updates parsed ad DOM in
memory. It also keeps DummyModuleInfo and everything necessary, which accounts
for  ~2MB with current AU size (~190 modules listed).

I understand AU is going to be completely rewritten, so consider this issue a
friendly remainder of known problem and a notice we need to evaluate new AU for
memory consumption.
Comment 1 Petr Nejedly 2007-04-14 09:20:33 UTC
I hoped this problem will cease to exist with new Plugin Manager, but it seems
it got replaced with similar problem.
With the new manager, after looking at the UI and closing it (so it is probably
no longer caused just by starting the IDE while having netbeans.org reachable),
there were 11MB in two char[] left on my heap (and also bunch of DOM structures,
but they were not that significant compared to this ;-) )
The arrays are reachable through DOMParser instance, which is kept in some
ThreadLocals, keyed from XMLUtil.builerTL.
This might be the real source of the problem.

Comment 2 Jiri Rechtacek 2007-04-14 10:21:34 UTC
part of fix #98168: Autoupdate keeps too much data in memory;
don't hold references into DOM
Checking in SimpleItem.java;
/shared/data/ccvs/repository/autoupdate/services/src/org/netbeans/modules/autoupdate/updateprovider/SimpleItem.java,v
 <--  SimpleItem.java
new revision: 1.3; previous revision: 1.2
done
Comment 3 Jiri Rechtacek 2007-04-14 10:29:49 UTC
One more fix SimpleItem.java;
/shared/data/ccvs/repository/autoupdate/services/src/org/netbeans/modules/autoupdate/updateprovider/SimpleItem.java,v
 <--  SimpleItem.java
new revision: 1.4; previous revision: 1.3
done
Comment 4 Petr Nejedly 2007-04-16 10:02:29 UTC
I tried to workaround the xml leak (issue 101103) and repeat the measurement.
Still, the memory isn't freed after closing plugin manager.
The UpdateManagerImpl keeps a lot of info (UpdateUnit->UpdateItem->ModuleItem)
in memory even after closing the UI. This info is quite expensive, as the module
licenses alone (linked from ModuleItem) consume over 1.5MB
Is it necessary to keep all the info all the time? I believe not.
Caching the (downloaded as compressed) catalog on disk and parsing it again on
demand should be fast enough.
Comment 5 Petr Nejedly 2007-06-01 08:23:42 UTC
This leak is still there and consuming more than 2MB of the heap. It will get
more pronounced with the plugin portal and more available modules.
Leak -> P2
Comment 6 Jiri Rechtacek 2007-08-08 10:59:08 UTC
UpdateManager shouldn't be singleton but replaced by factory. Then instance of UM may holds instance of UpdateUnits
which disappears when instance of UM will be released. 
Comment 7 Jiri Rechtacek 2007-08-28 15:03:59 UTC
*** Issue 113959 has been marked as a duplicate of this issue. ***
Comment 8 rmatous 2007-09-21 17:20:02 UTC
/cvs/autoupdate/services/src/org/netbeans/modules/autoupdate/services/UpdateUnitProviderImpl.java,v  <--  new revision:
1.21; previous revision: 1.20

/cvs/autoupdate/services/src/org/netbeans/modules/autoupdate/services/UpdateManagerImpl.java,v  <--  new revision: 1.14;
previous revision: 1.13

/cvs/autoupdate/services/test/unit/src/org/netbeans/modules/autoupdate/services/UpdateManagerImplTest.java,v  <--  new
revision: 1.4; previous revision: 1.3

/cvs/autoupdate/services/test/unit/src/org/netbeans/modules/autoupdate/services/InstallEagerModuleTest.java,v  <--  new
revision: 1.8; previous revision: 1.7

/cvs/autoupdate/services/test/unit/src/org/netbeans/api/autoupdate/DefaultTestCase.java,v  <--  DefaultTestCase.java
new revision: 1.9; previous revision: 1.8