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.
Run the following program under the profiler and turn on memory profiling. You will see that the finalize methods never get called, and the profiling data shows the Main thread objects are never garbage collected. Run the program as normal (without the profiler) and you will see that the finalize methods do get called. This is very misleading when you are trying to find memory leaks using the profiler. See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6520834 /* * Main.java * * Created on February 8, 2007, 10:31 AM */ package Threads; /** * * @author ekolotyluk */ public class Main extends Thread { public void run() { System.out.println(getName() + " - starting"); try { sleep((int) (Math.random() * 100000)); } catch (InterruptedException e) { } System.out.println(getName() + " - stopping"); } public void finalize() { System.out.println(getName() + " - finalizing"); } public static void main(String [] arguments) { for (int i = 0; i < 100; i++) { Main main = new Main(); main.start(); try { Thread.sleep(2000); System.gc(); } catch (InterruptedException e) { } } System.exit(0); } }
Maybe worth to mention: as I have reported on the mailing list (see http://article.gmane.org/gmane.comp.java.netbeans.modules.profiler.user/477), only those threads are not garbage collected, which did create new objects (what obviously most of all meaningful threads will do). But this might be interesting for debugging the problem. Frank-Michael
Fixed in trunk.
Patch for NetBeans Profiler 5.5 was made available. Download patch available here http://profiler.netbeans.org/download/patches/patch_for_issue_95020.zip and follow instructions in README.txt file
Fix merged to release551 branch
*** Issue 96566 has been marked as a duplicate of this issue. ***
*** Issue 99331 has been marked as a duplicate of this issue. ***
*** Issue 101221 has been marked as a duplicate of this issue. ***