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.
I am using netbeans profiler (milestone 5) to investigate memory leaks in our server code. I attach the profiler as follows - * Record both object creation and garbage collection * Take sample every "1" object allocations. With this setup, the profiler always reports certain types of objects in our system as "live". Obviously, at first I thought this was a genuine memory leak in our application. However after an exhastive search for the rogue references, I am convinced that this is in fact a profiler issue. To prove this, I wrote a simple "reference tracker" tool to get a second opinion on these supposed memory leaks. My reference tracker uses java.lang.WeakReference to monitor the objects. It periodically calls System.gc() to flush out any expired objects and then uses "WeakReference.get() == null" to check for liveness. Following are some of the observations made using this tool - 1. If I run the test without attaching the netbeans profiler, the reference tracker shows all the objects getting freed at the appropriate time. 2. If I repeat the same test with netbeans profiler, then both the profiler and my reference tracker show that the objects are "live"! However if I then click on "Reset Results Buffer", the "reference tracker" immediately shows the objects getting freed. 3. Same thing happens if I detach the profiler. As soon as the profiler is detached, the "reference checker" reports the objects as unreachable. 4. Finally, if I use the netbeans profiler as just a heap monitor (i.e. without any instrumentation) and run the test in a loop, it does not show any growth in the heap usage. Please let me know if there is anything else I can do to help.
This problem seems to be related to either the number of instrumented classes or number of instances of those classes. If I start with memory instrumentation as described before and then eliminate the instrumentation for a large number of classes, at some point everything starts working correctly - i.e. profiler stops reporting spurious memory leaks.
As a first step to investigate this problem, we would like to send the user a patch that fixes a number of other issues found in M5. Next we shall see if further investigation is needed. If the patch doesn't fix this issue, it would be very desirable to obtain from the user either the actual application or a reduced test case that reproduces this problem.
Please let us know whether you received the patch and whether or not anything with this issue changed after you installed it. Regards, Misha
Unless I hear back from you within a day or two, I assume that the patch worked and fixed this issue. Regards, Misha
Yes, the patch did fix this problem. Thanks. I am planning to test it a bit more tomorrow, but please feel free to close the bug.
Fixed in M6. Probably was a side-effect of an issue with incorrectly injected memory profiling instrumentation.
Verification of old issues.
Closing old issues.