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.
While trying to track down a `ClassLoader` leak, whereby one of the loaded `Class`s is held strongly from a data structure, I found that `LiveReferences.fromRoots` called on the `ClassLoader` returns an empty map even though the loader is strongly held. I tracked this down to a couple of missing calls in `InsaneEngine`: while it does traverse the `classLoader` link for purposes of finding objects to process, it fails to properly notify the visitor of this link, making `LiveEngine` unable to report the cause of a memory leak. https://github.com/jenkinsci/jenkins-test-harness/pull/32/files#diff-00de86199afe99b23cc690ce65ddca02R209 both notes where the calls must be made, and shows how to work around the issue with a `LiveEngine` override. `Path.getField` could probably be improved in this case, but it works well enough as is. While I am here, I also had an RFE for `LiveEngine`: allow a custom `Filter` to be set, without logically ANDing it with `skipNonStrongReferencesFilter`, so that a caller may look for soft or even weak root references, in case no strong references still seem to be held. I also tested a couple of assertions which helped develop the fix and workaround (otherwise `Path.getField` can fail with a cryptic `NullPointerException` long after the damage is done): * The `Path` constructor should throw an exception if `item == null`. * `LiveEngine.getIncomingRefs` should throw an exception if `oo == null`.
Some more buglets: * `InsaneEngine.recognizeObject` should not do anything special about `sun.reflect.` (this case can happen). * `ScannerUtils.interestingRoots` omits Java Platform classes which have `static` fields that can hold on to application objects. In particular should add: ** Class.forName("java.io.ObjectStreamClass$Caches") ** Class.forName("java.beans.ThreadGroupContext") Are you accepting patches in this component? I would like to stop needing to maintain more and more workarounds.