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.
Created attachment 163008 [details] Profiling session showing repeatedly hung EDT thread during background scanning of projects and otherwise idle editor The "Background scanning of projects" hangs the EDT thread, making the IDE completely unusable. Every 3.75 seconds on average the UI responds again for a very brief time (<1 sec) before becoming unresponsive again for another 3.75 seconds. This repeats over and over again until the scanning process is over. The attached profiling snapshot was recorded while project scanning was happening after opening the "refactoring.java" module in the NetBeans IDE source code. During this snapshot the IDE is being left idle with the cursor blinking in an open Java editor and the "Background scanning of projects" ongoing (with its progress bar showing in the toolbar). The hung EDT thread can be clearly seen from the call stack graph.
Related bugs: https://netbeans.org/bugzilla/show_bug.cgi?id=228822 (relating to save action--closed incomplete) https://netbeans.org/bugzilla/show_bug.cgi?id=243483 (relating to save action--but seems to be the same problem)
Reassigning for further evaluation.
*** Bug 243483 has been marked as a duplicate of this bug. ***
Created attachment 163009 [details] Call stack graph showing repeatedly hung IDE (from attached profiling session)
This issue has nothing to do with profiler. Thanks for self-sampler snapshot. The snapshot shows that the problem seems to be caused by excessive GC. Please try to reproduce it once more and attach new self-sampler snapshot and messages.log file from the same IDE run. Thanks.
Created attachment 163253 [details] .npss file attached from NetBeans .npss file
Created attachment 163254 [details] messages.log file for NetBeans session during EDT hang during indexing As requested, I've uploaded a new snapshot and messages.log file during a hang. This time, the same hang was triggered by adding a method in a Java file (an abstract superclass of several other classes) and saving the changes, causing reindexing.
After observing this bug and earlier variations of it for four years (first reported as #228822), I have finally figured it out. The problem is that the launcher script used in the MacOS distribution of NetBeans caps the heap size at 1GB, regardless of the amount of memory available on the user's computer. This can be seen in the "heap_size" method in the "Contents/MacOS/netbeans" script in the NetBeans application bundle: ----- if [ $mem -gt 1024 ] ; then mem=1024 ----- Manually setting -J-Xmx3072M in netbeans.conf makes the problem go away. Before setting this, I observed hangs almost daily (requiring an IDE restart)--but now, for the last two months, I have never observed the problem. The fact that the IDE runs for weeks without problems suggests the problem was simply a heap size issue, rather than a memory leak. I suggest changing the maximum heap size policy in the netbeans startup script. Maybe set the maximum heap size to half or a third of the available memory rather than a fifth, and eliminate the 1GB cap?