Heisenbug -> NSInvalidArgumentException: capacity is ridiculous
I get a very confusing crash where I am currently running out of my wisdom...

First the crash log:

Date/Time:       2012-02-14 10:55:09.771 +0100   
OS Version:      Mac OS X 10.7.3 (11D50b)  
Report Version:  9

Crashed Thread:  0

Exception Type:  EXC_CRASH (SIGABRT)  
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:   
iPhone Simulator 272, iPhone OS 5.0 (iPhone/9A334)
 
abort() called  
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithCapacity:]: capacity (2147483648) is ridiculous'
*** First throw call stack:
(0x25ca052 0x21d8d0a 0x24f21b7 0x252597b 0x688e2 0x6a3b5 0x41b2f 0x1f29d 0x1f87e 0xba335c 0xbabd0d 0xcc8a1c 0xcc93a9 0xf3de39 0xf3d143 0xf3e3cf 0xf40a31 0xf4098c 0xf393e7 0xca1812 0xca1ba2 0xc88384 0xc7baa9 0x2333fa9 0x259e1c5 0x2503022 0x250190a 0x2500db4 0x2500ccb 0x2332879 0x233293e 0xc79a9b 0x23ad 0x2325)
 

Thread 0 Crashed:  
0   libsystem_kernel.dylib        	0x983379c6 __pthread_kill + 10  
1   libsystem_c.dylib             	0x939e7f78 pthread_kill + 106  
2   libsystem_c.dylib             	0x939d8bdd abort + 167  
3   libc++abi.dylib               	0x01fa5e78 abort_message + 50  
4   libc++abi.dylib               	0x01fa389e _ZL17default_terminatev + 34  
5   libobjc.A.dylib               	0x021d8f4b _objc_terminate + 94  
6   libc++abi.dylib               	0x01fa38de _ZL19safe_handler_callerPFvvE + 13  
7   libc++abi.dylib               	0x01fa3946 std::terminate() + 23  
8   libc++abi.dylib               	0x01fa4b3e __cxa_rethrow + 83  
9   libobjc.A.dylib               	0x021d8e49 objc_exception_rethrow + 47  
10  CoreFoundation                	0x02500e10 CFRunLoopRunSpecific + 304  
11  CoreFoundation                	0x02500ccb CFRunLoopRunInMode + 123  
12  GraphicsServices              	0x02332879 GSEventRunModal + 207  
13  GraphicsServices              	0x0233293e GSEventRun + 114  
14  UIKit                         	0x00c79a9b UIApplicationMain + 1175  
15  LVM                           	0x000023ad main + 125 (main.m:14)  
16  LVM                           	0x00002325 start + 53  

I am working under Lion 10.7.3 with Xcode 4.2.
The analyzer does not indicate an error and the project was running stable until yesterday.
The error itself is not caused during setup, but by a gesture which reloads the necessary data to display. 

At the first glance it seems to be clear: I have allocated a NSDictionary instance with an invalid capacity (2147483648 is in fact a signed -2147483648 so it may be an overflow artifact).

- My system has all the necessary settings to stop when a crash occurs: NSZombieEnabled, 
  obj_exc_throw etc. Well, it stops, but in the main loop in main.m. So no info to see.
- So I looked up all my NSXXDictionary instances and guaranteed that they all have constant
  capacity initializers or use their [... dictionary] allocations. First surprise: It still
  crashes.
- Ok, it may be that Xcode sometimes does not recompile changes correctly ? Xcode closed,
  clean, rebuild, throwing the build dir (build, caches, dstroot) away, restart, anything.
  Still the same crash.
- As you see, it crashes in the running loop so I don't get much information about the
  location. Ok, start up Profile->System Trace and look if I can find....System trace crashes ! 8-0
- Erm....my coworkers have no problem with the current changes, so I tried to find with SVN
  where exactly the problems arise. And here I am again stuck: The error disappears and
  appears so I cannot pin down the cause. 

So...are there any other datastructures (NSArray etc.) or functions which may cause this strange behavior ? Or do you have any good debugging tips to pin it down ?
Thanks for any useful help

Heisenbug -> NSInvalidArgumentException: capacity is ridiculous
===

I get a very confusing crash where I am currently running out of my wisdom...

First the crash log:

Date/Time:       2012-02-14 10:55:09.771 +0100   
OS Version:      Mac OS X 10.7.3 (11D50b)  
Report Version:  9

Crashed Thread:  0

Exception Type:  EXC_CRASH (SIGABRT)  
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:   
iPhone Simulator 272, iPhone OS 5.0 (iPhone/9A334)
 
abort() called  
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithCapacity:]: capacity (2147483648) is ridiculous'
*** First throw call stack:
(0x25ca052 0x21d8d0a 0x24f21b7 0x252597b 0x688e2 0x6a3b5 0x41b2f 0x1f29d 0x1f87e 0xba335c 0xbabd0d 0xcc8a1c 0xcc93a9 0xf3de39 0xf3d143 0xf3e3cf 0xf40a31 0xf4098c 0xf393e7 0xca1812 0xca1ba2 0xc88384 0xc7baa9 0x2333fa9 0x259e1c5 0x2503022 0x250190a 0x2500db4 0x2500ccb 0x2332879 0x233293e 0xc79a9b 0x23ad 0x2325)
 

Thread 0 Crashed:  
0   libsystem_kernel.dylib        	0x983379c6 __pthread_kill + 10  
1   libsystem_c.dylib             	0x939e7f78 pthread_kill + 106  
2   libsystem_c.dylib             	0x939d8bdd abort + 167  
3   libc++abi.dylib               	0x01fa5e78 abort_message + 50  
4   libc++abi.dylib               	0x01fa389e _ZL17default_terminatev + 34  
5   libobjc.A.dylib               	0x021d8f4b _objc_terminate + 94  
6   libc++abi.dylib               	0x01fa38de _ZL19safe_handler_callerPFvvE + 13  
7   libc++abi.dylib               	0x01fa3946 std::terminate() + 23  
8   libc++abi.dylib               	0x01fa4b3e __cxa_rethrow + 83  
9   libobjc.A.dylib               	0x021d8e49 objc_exception_rethrow + 47  
10  CoreFoundation                	0x02500e10 CFRunLoopRunSpecific + 304  
11  CoreFoundation                	0x02500ccb CFRunLoopRunInMode + 123  
12  GraphicsServices              	0x02332879 GSEventRunModal + 207  
13  GraphicsServices              	0x0233293e GSEventRun + 114  
14  UIKit                         	0x00c79a9b UIApplicationMain + 1175  
15  LVM                           	0x000023ad main + 125 (main.m:14)  
16  LVM                           	0x00002325 start + 53  

I am working under Lion 10.7.3 with Xcode 4.2.
The analyzer does not indicate an error and the project was running stable until yesterday.
The error itself is not caused during setup, but by a gesture which reloads the necessary data to display. 

At the first glance it seems to be clear: I have allocated a NSDictionary instance with an invalid capacity (2147483648 is in fact a signed -2147483648 so it may be an overflow artifact).

- My system has all the necessary settings to stop when a crash occurs: NSZombieEnabled, 
  obj_exc_throw etc. Well, it stops, but in the main loop in main.m. So no info to see.
- So I looked up all my NSXXDictionary instances and guaranteed that they all have constant
  capacity initializers or use their [... dictionary] allocations. First surprise: It still
  crashes.
- Ok, it may be that Xcode sometimes does not recompile changes correctly ? Xcode closed,
  clean, rebuild, throwing the build dir (build, caches, dstroot) away, restart, anything.
  Still the same crash.
- As you see, it crashes in the running loop so I don't get much information about the
  location. Ok, start up Profile->System Trace and look if I can find....System trace crashes ! 8-0
- Erm....my coworkers have no problem with the current changes, so I tried to find with SVN
  where exactly the problems arise. And here I am again stuck: The error disappears and
  appears so I cannot pin down the cause. 

So...are there any other datastructures (NSArray etc.) or functions which may cause this strange behavior ? Or do you have any good debugging tips to pin it down ?
Thanks for any useful help
