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.
Created attachment 157571 [details]
Trail of references in JProfiler
I tested your project with NetBeans 8.2 and with setting to Xmx24M. "MutableLookup" instance are collected after some time.