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.
Hy, I've started investigating this issue when NetBeans (6.5) was taking 14% of my Core2Due 2.4Ghz while being idle. After profiling, I've notices that of the consumed CPU the spread was: org.netbeans.core.TimableEventQueue.postEvent (31.3%) + dispatchEvent (5%) apple.laf.CUIAquaProgressBar$Animator.actionPerformed(25.1%) So, we were leaking progress bars somewhere. Armed with a btrace script, I traced the culprit to the NbProgressBar instances that were being leaked in progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java and progress.ui/src/org/netbeans/modules/progress/ui/StatusLineComponent.java By leaked I don't mean a normal GC leak but basically the fact that we are not using a workaround to avoid an OSX bug: each JProgressBar gets a new thread to send repaint events basically in order to achieve that animation effect. The problem is that the thread is started upon the JProgressBar's creation and stopped only when the bar is taken out from the container (the problem being that if it was never *added* to a container, we get an ever-lasting thread). See the attached patch which fixes this issue. The problem per-se isn't just in Progress UI, it might happen with each (Nb|J)ProgressBar if we just instantiate but never use it. IDEA had the same problem: http://www.jetbrains.net/jira/browse/IDEADEV-25376 Last time I saw it it was on java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode) so not exactly an old JDK.
Created attachment 86457 [details] Progress UI patch to avoid the timer leaks
Created attachment 86458 [details] BTrace script that allows you to see the events being sent and relevant method calls
Created attachment 86460 [details] Huge log file after btrace execution. Notice for example how the org.netbeans.modules.progress.ui.NbProgressBar@2a565e62 instance still gets animated long after discardBar is called on line #1975.
Created attachment 86461 [details] BTrace log file after patch was applied. Note the silence and low number of lines: 1565 compared to over 40000 in the other log.
Tomasi, could you please review Emilian's patch and possibly integrate it if you find no problems? Thanks!
Good work! Thanks for patch, integrated in core-main #fe8f96e83ea5
Integrated into 'main-golden', will be available in build *200908210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/fe8f96e83ea5 User: Tomas Holy <t_h@netbeans.org> Log: #170625: Progress UI leaks refresh timers on OSX, leading to high CPU usage