Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 201387

Summary: Java Debugger Conditional Breakpoint Performance
Product: debugger Reporter: rhollencamp
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: NEW --- QA Contact: issues <issues.netbeans.org>
Priority: P3 Keywords: PERFORMANCE
Version: 7.0.1   
Target Milestone: 7.2   
Hardware: PC   
OS: Windows 7 x64   
Whiteboard:
Issue Type: ENHANCEMENT Exception Report:
Attachments: Overview of memory utilization during debugging

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++) {
			doWork(i);
		}
	}

	private static void doWork(int i) {
		return;
	}



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) {
        System.out.println("foo");
}

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?
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo