underretain in CoreAnimation / iPhone Simulator

Sat, 12. Dec 2009

Categories: de development Tags: 3 3.2.1 Cocoa CoreAnimation iPhone Simulator Snow Leopard underretain XCode

After upgrading to Snow Leopard and XCode 3.2.1 I’ve seen such console output

CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3838000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

when rotating the iPhone Simulator in a project with base SDK 3.0.

This can be reproduced as follows:

1// Override to allow orientations other than the default portrait orientation.
2- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
3  // Return YES for supported orientations.
4  return YES;
5}
6
7-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
8  NSLog(@"willRotateToInterfaceOrientation");
9}

to the RootViewConroller.m * set the base SDK to 3.0:

Base SDk 3.0

Base SDk 3.0

* compile + run with Simulator 3.1.2, everthing fine when rotating the simulator:
Simulator 3.1.2 rotates fine

Simulator 3.1.2 rotates fine

* Simulator 3.0 shows the underretain:
Simulator 3.0 underretain

Simulator 3.0 underretain

 1[Session started at 2009-12-12 21:49:31 +0100.]
 2GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
 3Copyright 2004 Free Software Foundation, Inc.
 4GDB is free software, covered by the GNU General Public License, and you are
 5welcome to change it and/or distribute copies of it under certain conditions.
 6Type "show copying" to see the conditions.
 7There is absolutely no warranty for GDB.  Type "show warranty" for details.
 8This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
 9Attaching to process 32139.
102009-12-12 21:49:43.845 CAUnderRetain[32139:207] willRotateToInterfaceOrientation
11CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x1853000: pointer being freed was not allocated
12*** set a breakpoint in malloc_error_break to debug
13CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3824000: pointer being freed was not allocated
14*** set a breakpoint in malloc_error_break to debug
15warning: Unable to restore previously selected frame.
16warning: Couldn't find minimal bounds for "_sigtramp" - backtraces may be unreliable
17(gdb) break malloc_error_break
18Breakpoint 1 at 0x92626072
19(gdb) continue
202009-12-12 21:49:58.490 CAUnderRetain[32139:207] willRotateToInterfaceOrientation
21CAUnderRetain(32139,0xa0391500) malloc: *** error for object 0x3838000: pointer being freed was not allocated
22*** set a breakpoint in malloc_error_break to debug
23
24Unable to disassemble malloc_error_break.
25(gdb) bt
26#0  0x92626072 in malloc_error_break ()
27#1  0x92535303 in free ()
28#2  0x0015ce49 in dataReleaseInfo ()
29#3  0x001481d9 in data_provider_finalize ()
30#4  0x30204421 in _CFRelease ()
31#5  0x00147fa2 in image_finalize ()
32#6  0x30204421 in _CFRelease ()
33#7  0x00c12ded in CALayerStateRelease ()
34#8  0x00c18290 in -[CALayer dealloc] ()
35#9  0x00c0a00e in CALayerRelease ()
36#10 0x00c0b265 in CA::release_root_if_unused ()
37#11 0x00c0b1ef in x_hash_table_remove_if ()
38#12 0x00c0afd4 in CA::Transaction::commit ()
39#13 0x00c132e0 in CA::Transaction::observer_callback ()
40#14 0x30245c32 in __CFRunLoopDoObservers ()
41#15 0x3024503f in CFRunLoopRunSpecific ()
42#16 0x30244628 in CFRunLoopRunInMode ()
43#17 0x32044c31 in GSEventRunModal ()
44#18 0x32044cf6 in GSEventRun ()
45#19 0x309021ee in UIApplicationMain ()
46#20 0x00002018 in main (argc=1, argv=0xbfffea84) at /Users/.../CAUnderRetain/main.m:14
47(gdb)