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 56203 - Object liveness tracking appears to be broken
Summary: Object liveness tracking appears to be broken
Status: CLOSED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 4.x
Hardware: All Windows ME/2000
: P2 blocker (vote)
Assignee: mishadmitriev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-10 21:28 UTC by s15r
Modified: 2007-02-12 22:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description s15r 2005-03-10 21:28:02 UTC
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.
Comment 1 s15r 2005-03-22 19:43:58 UTC
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.
Comment 2 mishadmitriev 2005-03-28 09:19:48 UTC
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.
Comment 3 mishadmitriev 2005-03-31 04:46:52 UTC
Please let us know whether you received the patch and whether or not anything
with this issue changed after you installed it.

Regards,

Misha
Comment 4 mishadmitriev 2005-04-03 23:09:08 UTC
Unless I hear back from you within a day or two, I assume that the patch worked
and fixed this issue.

Regards,

Misha
Comment 5 s15r 2005-04-04 04:46:37 UTC
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.
Comment 6 mishadmitriev 2005-04-04 07:29:44 UTC
Fixed in M6. Probably was a side-effect of an issue with incorrectly injected
memory profiling instrumentation.
Comment 7 ehucka 2006-10-09 12:11:09 UTC
Verification of old issues.
Comment 8 Alexander Kouznetsov 2007-02-12 22:30:17 UTC
Closing old issues.
Comment 9 Alexander Kouznetsov 2007-02-12 22:30:57 UTC
Closing old issues.