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 256880

Summary: Memory issue with lookup
Product: platform Reporter: tdanard
Component: LookupAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal CC: jtulach
Priority: P2    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Sample NetBeans Platform Application
Trail of references in JProfiler

Description tdanard 2015-11-30 23:35:18 UTC
Created attachment 157570 [details]
Sample NetBeans Platform Application

When I upgraded from NetBeans 7.3.1 from NetBeans 8.0.2, I encountered an issue where the lookup system keeps references to obsolete lookup instances, leading to countless memory leaks.

This is regression as lookups were properly cleaned up with NetBeans 7.3.1. This issue is present with 8.0.2 and 8.1. I didn't test it with other versions.

I have attached a sample NetBeans Platform Application module suite that reproduces this issue. You can run it both with NetBeans 7.3.1 and NetBeans 8.0.2. I have also attached the trail of references preventing a proper garbage collection that JProfiler reports.

To use this sample project, start the application. Click the "Create Window" button in the toolbar then click the "Selection Action" in the toolbar. Close the window. Run a profiler and look for a "MutableLookup" instance. With 7.3.1, the MutableLookup instance is garbage collected. With 8.0.2, it is not.

This issue is critical for me as it prevents me from upgrading to recent versions of NetBeans. I tried to look into the lookup code, but couldn't find the root cause or a workaround.
Comment 1 tdanard 2015-11-30 23:39:26 UTC
Created attachment 157571 [details]
Trail of references in JProfiler
Comment 2 Tomas Hurka 2017-02-15 15:51:00 UTC
I tested your project with NetBeans 8.2 and with setting to Xmx24M. "MutableLookup" instance are collected after some time.