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.
Summary: | OutOfMemoryError: Big number of org.netbeans.modules.db.explorer.node.NodePropertySupport | ||
---|---|---|---|
Product: | db | Reporter: | idclaar <idclaar> |
Component: | Code | Assignee: | matthias42 |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 215664 |
Attachments: | stacktrace |
Description
idclaar
2015-02-25 13:16:13 UTC
Created attachment 152209 [details]
stacktrace
There are 1,498,167 instances of org.netbeans.modules.db.explorer.node.NodePropertySupport class *** Bug 250775 has been marked as a duplicate of this bug. *** Ok - there is an excessive number of nodes and node supporting classes created. NodePropertySupport is instantiated for each read-only property for each node. Two things were done now: - instantiate the node-comparators only once and not once per parent class (with 10.000 Tables this shaved approx. 10.000 instances off) - The ActionRegistry was removed in favor of using org.openide.util.Utilities#actionsForPath ondemand that is another 10.0000 instances for my example Integrated into 'main-silver', will be available in build *201503140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/38f41cb275a6 User: Matthias Blaesing <matthias42@netbeans.org> Log: #250690: don't instanziate db object comparators per parent node -> move them to static final instances I pushed two more changesets concluding the series for now. The two changes: http://hg.netbeans.org/core-main/rev/b380fa1b40ac Catalog-Nodes, Connection-Nodes and Schema-Nodes were held strongly by their property changelisteners on the database connection. These in turn held strong references to Table nodes. This change moves them to WeakListeners and now the nodes are correctly collected after connection disconnect. http://hg.netbeans.org/core-main/rev/f3ca1c8c8b69 The private variable props held a list of _all_ NodePropertySupport object for the node. On each refresh the properties are refreshed via the addProperty method. This works for the sheet, which replaces the existing property, but the props list just got longer. The solution: Don't use the list. The only method really using the list: getProperties, is never called in normal usage, so the properties are extracted from the property sheet on demand. My tests with a 50 Tables DB showed this: First Step: 1. Open db hierarchy until the tables are listed 2. call refresh on tables node 5 times 3. Issue an alter table command 4. call refresh on tables node once again => Take heap dump Second Step: 5. refresh two times again => Take heap dump This is the instance count for NodePropertySupport: First step Second Step With out the patch: 5517 7261 With the patch: 1164 1164 I'll close the bug at this point. If there are still problem in the node/property handling I'll take another look, but then I'd need: the size of the db, preferably a heap dump. If someone could verify my findings I would appretiate that! Integrated into 'main-silver', will be available in build *201503210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/b380fa1b40ac User: Matthias Blaesing <matthias42@netbeans.org> Log: #250690: Ensure property change listeners on connection are registered as WeakListeners |