My app (seemingly in debug mode only), sometimes (in seemingly unpredictable ways) beachballs infinitely during this simple statement:
NSOpenPanel *panel = [NSOpenPanel openPanel];
It just beachballs infinitely. Nothing is happening. The memory usage is not changing at all. It could be that the app is hitting an infinite loop somewhere within the frameworks.
What could possibly be causing this? How could I analyze the cause?
As to how to analyze it: When you say “debug mode”, do you mean it’s running under the debugger? If so, what happens if you hit the Pause button?
Another possibility is to use Activity Monitor to take a sample of your process while it’s beachballing.