Hello. I am pretty new to Objective-C programming and am having some issues with memory management. I found a good debugging tool in the "shell malloc_history" command but am having some trouble deciphering the output. This is the output I am receiving:
This makes me believe there is a problem in my loadelf: function, particularly a line [NSString stringWithFormat:]. I've located this line (the only time I use [NSString stringWithFormat:] in this function and it reads:
My code is more often than not crashing with this error:
My questions are:
Am I looking in the right place for this malloc issue?
If so what is wrong with this line of code?? I have used this technique throughout my entire program and have had no issues.
Thanks again for any help anyone can provide and if some more info is needed please let me know and I will post it as soon as possible.
Code:
ALLOC 0xdd59a50-0xdd59a6f [size=32]: thread_a02c9500 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ | MultiplexerSource::perform() | URLConnectionClient::processEvents() | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) | _NSURLConnectionDidFinishLoading | -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] | -[URLRequest connectionDidFinishLoading:] | -[vmAppDelegate executeBoincBinary:] | -[virtual_machine_32 loadelf:] | +[NSString stringWithFormat:] | -[NSPlaceholderString initWithFormat:locale:arguments:] | _CFStringCreateWithFormatAndArgumentsAux | CFStringCreateMutable | _CFRuntimeCreateInstance | malloc_zone_malloc
Code:
[memory setValue:[NSNumber numberWithInt:[filespace characterAtIndex:b]] forKey:[NSString stringWithFormat:@"%i", addr+b-offset]];
Code:
2010-08-16 21:20:11.944 vm[16315:207] *** -[CFString length]: message sent to deallocated instance 0xe4efd40
Am I looking in the right place for this malloc issue?
If so what is wrong with this line of code?? I have used this technique throughout my entire program and have had no issues.
Thanks again for any help anyone can provide and if some more info is needed please let me know and I will post it as soon as possible.