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 227227

Summary: Switching between elements too often cause netbeans freeze for a while and cpu,memory usage surge.
Product: cnd Reporter: hooluupog
Component: NavigationAssignee: Vladimir Voskresensky <vv159170>
Status: VERIFIED FIXED    
Severity: normal CC: gorrus, mmirilovic, sindisil
Priority: P2    
Version: 7.3   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description hooluupog 2013-03-09 05:23:00 UTC
To reproduce it:
1)Open a cpp file with many functions and classes in a project;
2)Double-click #defines, variables, functions, etc in navigator window time and time again.
Finally,netbeans will freeze for a while and memory,cpu usages become very high.
Comment 1 Vladimir Voskresensky 2013-03-13 06:08:29 UTC

*** This bug has been marked as a duplicate of bug 225449 ***
Comment 2 Jaroslav Tulach 2013-03-27 13:43:42 UTC
getLookup() method should always return the same instance, not create new one on every invocation.

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html>NavigatorComponent.java (<b>Jan 23, 2013 7:05:07 PM</b>)</html>
+++ <html><b>Current File</b></html>
@@ -147,6 +147,13 @@
         }
     }
     
+    class N extends ProxyLookup {
+        void update(Lookup... arr) {
+            setLookups(arr);
+        }
+    }
+    N n = new N();
+    
     @Override
     public Lookup getLookup() {
         synchronized(lock) {
@@ -154,10 +161,11 @@
                 return getPanelUI().getLookup();
             } else {
                 if (getPanelUI().getLookup().lookup(Node.class) == null) {
-                    return new ProxyLookup(getPanelUI().getLookup(), Lookups.fixed(curData.getNodeDelegate(), curData, curData.getPrimaryFile()));
+                    n.update(getPanelUI().getLookup(), Lookups.fixed(curData.getNodeDelegate(), curData, curData.getPrimaryFile()));
                 } else {
-                    return new ProxyLookup(getPanelUI().getLookup(), Lookups.fixed(curData, curData.getPrimaryFile()));
+                    n.update(getPanelUI().getLookup(), Lookups.fixed(curData, curData.getPrimaryFile()));
                 }
+                return n;
             }
         }
     }
Comment 3 Vladimir Voskresensky 2013-03-28 05:05:17 UTC
Thanks, Jarda:
http://hg.netbeans.org/cnd-main/rev/15c8e2da0550
Comment 4 Quality Engineering 2013-03-29 02:08:33 UTC
Integrated into 'main-golden', will be available in build *201303282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/15c8e2da0550
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed (by Jarda) #227227 Switching between elements too often cause netbeans freeze for a while and cpu,memory usage surge.
- use one lookup instance
Comment 5 Vladimir Voskresensky 2013-04-09 09:58:02 UTC
verified
Comment 6 soldatov 2013-05-14 11:01:27 UTC
Verified in NetBeans 7.3 patch 2
Comment 7 Jan Peska 2013-07-17 07:16:19 UTC
*** Bug 226807 has been marked as a duplicate of this bug. ***