1

I am working on simple iphone application. where i am working on two views. I pushed the other view controller first and when i am removing the current view as to go back to the old view controller i am getting [CALayer retain]. EXEC_BAD_ACCESS.

In gdb, i tried backtrace command to see the problem which i have given below, but i am not able to find any. If anyone can help me out with this it will be great.

(gdb) backtrace

#0  0x02e21434 in ___forwarding___ ()
#1  0x02e209f2 in __forwarding_prep_0___ ()
#2  0x02dc7f58 in CFRetain ()
#3  0x02dc7a65 in CFArrayCreate ()
#4  0x02dfe043 in -[__NSPlaceholderArray initWithObjects:count:] ()
#5  0x0296eda3 in -[CALayerArray copyWithZone:] ()
#6  0x02ea380a in -[NSObject copy] ()
#7  0x004f742a in -[UIView dealloc] ()
#8  0x00214cb2 in NSPopAutoreleasePool ()
#9  0x004d3698 in _UIApplicationHandleEvent ()
#10 0x035fe17c in PurpleEventCallback ()
#11 0x02df289c in CFRunLoopRunSpecific ()
#12 0x02df18a8 in CFRunLoopRunInMode ()
#13 0x035fc89d in GSEventRunModal ()
#14 0x035fc962 in GSEventRun ()
#15 0x004d1372 in UIApplicationMain ()
#16 0x00002074 in main (argc=1, argv=0xbffff020) at /Users/jtong/Desktop/Elle/main.m:14

Thanks, Aby

JustSid
  • 25,168
  • 7
  • 79
  • 97
insomiac
  • 5,648
  • 8
  • 45
  • 73

2 Answers2

2

Sounds like you're also explicitly releasing something that you've already autoreleased.

mharper
  • 3,212
  • 1
  • 23
  • 23
  • i figure out the problem it was in dealloc. I was not releasing in proper way. Thanks for the repsone. – insomiac Mar 14 '11 at 21:04
  • in dealloc. By mistake for one object i have kept [arr dealloc].. instead of [arr release]. This was causing a problem. – insomiac Mar 15 '11 at 14:50
  • Yup. And all the stacktrace tells you is that it is something visible (CALayer), so it could be a UILabel, UIImageView, etc. Annoyingly vague. Tip: search for 'release' and check that you have a matching retain or alloc. – Jason Moore Sep 14 '11 at 01:37
0

Use Instruments and enable Zombies. This will trace where each object was retained and released and will hell you diagnose where the extra release is occurring.

How to run iPhone program with Zombies instrument?

Community
  • 1
  • 1
Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
  • Hey paul i tried this but this is not working. When i started my application with performance tool it is crashing.. – insomiac Mar 14 '11 at 19:47