Bug 201387 - Java Debugger Conditional Breakpoint Performance
Summary: Java Debugger Conditional Breakpoint Performance
Status: NEW
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.0.1
Hardware: PC Windows 7 x64
: P3 normal with 1 vote (vote)
Assignee: Martin Entlicher
Depends on:
Reported: 2011-08-28 15:15 UTC by rhollencamp
Modified: 2013-02-24 16:33 UTC (History)
0 users

See Also:
Exception Reporter:

Overview of memory utilization during debugging (166.27 KB, image/png)
2011-08-28 15:15 UTC, rhollencamp

Note You need to log in before you can comment on or make changes to this bug.
Description rhollencamp 2011-08-28 15:15:52 UTC
Created attachment 110260 [details]
Overview of memory utilization during debugging

Conditional breakpoint performance when debugging a Java app is terrible. Test case:

	public static void main(String[] args) {
		for (int i = 0; i < 50000; i++) {

	private static void doWork(int i) {

Place a breakpoint on the call to doWork, and set a condition on the breakpoint: i == 49000. Start debugging. On my machine it takes over two minutes to hit the breakpoint. Looking at the memory utilization using VisualVM, Netbeans is thrashing pretty hard, creating all kinds of objects that are then garbage collected.

Workaround that I use is to put a block of code before the call to doWork:
if (i == 49000) {

I then place a breakpoint on the println; the breakpoint is reached almost instantly.
Comment 1 Martin Entlicher 2011-09-05 16:03:05 UTC
The problem is that the breakpoint condition is evaluated on the client side. The breakpoint breaks execution every time, the condition is evaluated and when it's false, the execution is resumed again. This makes the conditional breakpoints very slow.

I do not think that there is a way how to reliably execute conditions from the breakpoint location on the server side.

We can try to evaluate possible approaches for the next release.
Comment 2 peathal 2013-02-24 16:33:01 UTC
Same problem here for NetBeans 7.3.

A simple workaround is to put the if statement directly in the code and an unconditional breakpoint inside the if. Couldn't one do similar for the implementation? Why is the debugging 'server' limited in this way and the debugging client not?