user393553
user393553

Reputation:

NSZombie Enabled, MallocStackLogging

I am testing an EXE_BAD_ACCESS error. I have set NSZombieEnabled, MallocStackLogging, MallocStackLoggingNoCompact to YES. now in the debugger I get this message when I run my app in the debug mode from the device I could see this:

iota(3586) malloc: recording malloc stacks to disk using standard recorder
iota(3586) malloc: stack logs being written into /private/var/mobile/Applications/8E21A85B-369E-4487-962B-1550E56602DC/tmp/stack-logs.3586.iota.index
iota(3586) malloc: Please issue: cp /private/var/mobile/Applications/8E21A85B-369E-4487-962B-1550E56602DC/tmp/stack-logs.3586.iota.suRQjy.link /tmp/

and when I am about to hit the error I get,

2011-02-14 14:29:44.350 iota[3586:307] *** -[CFString autorelease]: message sent to deallocated instance 0x81eab70

Finally when I give the command in debugger to see the stack trace

(gdb) shell malloc_history 3586 0x81eab70

I get

malloc_history cannot examine process 3586 because the process does not exist.

Can anyone tell me what I am doing wrong, before the error is about the occur , I set

set env MallocStackLogging 1 in the debugger too

Thanks in Advance

Upvotes: 0

Views: 2585

Answers (2)

Sean Doyle
Sean Doyle

Reputation: 358

You might not be able to look at the malloc_history because you're running this on the device. I had the same error and Instruments was also freezing or not starting my application.

But - if I ran in the iOS simulator and then configured the allocations tool to handle zombies (this option wasn't available on the device) then I can see pretty quickly the object which was prematurely released.

Upvotes: 2

Marcio
Marcio

Reputation: 2107

From what I understand you are releasing manually a string that is already on the autorelease Pool.

All strings created with

[NSString stringWithFormat:@"some %@", @"text"];

And

[NSString stringWithString:@"some text"];

must not be manually released.

Upvotes: 1

Related Questions