nsautoreleasepool

GNUStep NSAutoreleasePool incompatibility

According to another Stack Overflow post the drain message is an Apple-only call: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello"); [pool drain]; return 0; Is it safe to replace drain with release? I am trying to port an Objective-C application to run on Linux (Ubuntu at the moment). Should I give up even b...

iPhone dev multi threaded, NSAutoreleasePool

I have a simple application that counts down to midnight and then plays a beeping sound over and over again and blinks the label showing the time. So the label blinking uses an NSTimer, while the beeping goes on its own Thread, so that the pure C function (for the system sound id completion callback) can use [NSThread sleepForTimeInterva...

NSAutoreleasePool problem

I am using this line of code in iphone 2.0 its work fine pool=[[NSAutoreleasePool alloc]init]; [pool release]; When i run this line of code in iphone 3.0 its give some leak message in the log screen.. That message is 2009-10-13 03:26:31.841 Spectrum[3946:4c2b] *** _NSAutoreleaseNoPool(): Object 0xd819d0 of class NSCFString autorele...

NSAutorelease memory leak

Hi all, I am getting this error message in the console: *** _NSAutoreleaseNoPool(): Object 0x10d2e0 of class NSPathStore2 autoreleased with no pool in place - just leaking I can't figure out what is the error? Thanks. ...

class NSCFNumber autoreleased with no pool in place - just leaking

Hi everyone, I am new to C++ and have just started to work on a project using threading. Currently my project involves the OpenGL and OpenCV libraries, and in the process of coding I encountered the following error : Current language: auto; currently c++ 2009-12-21 14:54:49.438 3DTestApp[3210:7803] *** _NSAutoreleaseNoPool(): Objec...

iPhone app freezes when parsing XML

My app freezes whenever I parse an XML feed. I have tried calling this instead: [NSThread detachNewThreadSelector:@selector(parseXML) toTarget:self withObject:nil]; which calls: -(void) parseXML { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self parseXMLFileAtURL:path]; [pool drain]; } but my app has ...

Loading images into NSArray using initWithObjects crashes but not with an NSMutableArray?

I'm doing some lazy loading of images into an array when the app has loaded. I have tried using an NSMutableArray and an NSArray (I don't need to alter the array once it's been created) but the latter crashes on me. ... [self performSelectorInBackground:@selector(loadImageArrays) withObject:nil]; ... - (void)loadImageArrays { NSAu...

How do I release an object allocated in a different AutoReleasePool ?

Hi, I have a problem with the memory management in Objective-C. Say I have a method that allocates an object and stores the reference to this object as a member of the class. If I run through the same function a second time, I need to release this first object before creating a new one to replace it. Supposing that the first line of ...

Using Apple autorelease pools without Objective-C

I am developing an application that needs to work on Linux, Windows and Mac OS X. To that purpose, I am using C++ with Qt. For many reasons, on Mac OS X, I need to use CoreFoundation functions (such as CFBundleCopyBundleURL) that creates core objects that need to be released with CFRelease. But doing so generate a lots of these warnings...

pointer being freed was not allocated. Complex malloc history help

I've followed the guides helpfully linked here: http://stackoverflow.com/questions/295778/iphone-debugging-pointer-being-freed-was-not-allocated-errors but the malloc_history is really throwing me for a loop, can anyone shed any light on the following: ALLOC 0x185c600-0x18605ff [size=16384]: thread_a068a4e0 |start | main | UIApplicati...

Memory allocation in detached NSThread to load an NSDictionary in background?

I am trying to launch a background thread to retrieve XML data from a web service. I developed it synchronously - without threads, so I know that part works. Now I am ready to have a non-blocking service by spawning a thread to wait for the response and parse. I created an NSAutoreleasePool inside the thread and release it at the end ...

Calling UIGetScreenImage() on manually-spawned thread prints "_NSAutoreleaseNoPool():" message to log

This is the body of the selector that is specified in NSThread +detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgument NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while (doIt) { if (doItForSure) { NSLog(@"checking"); doItForSure = NO; ...

AutoreleasePool in UIApplication Loop

Hello, i have an app that starts with the default code for iPhone Apps: NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; Cause my app never stopps, the [pool release] is never called. Has the standard UI loop of UIApplicationMain an own AutoreleasePool ...

Can I early-release an autorelease object?

i.e. would cause the object to be released immediately and not have to be released by the pool if I did this? [[NSArray arrayWithCapacity:100] release]; Can't find a clear explanation in the docs about this. ...

Objective-C autorelease pool not releasing object

Hi I am very new to Objective-C and was reading through memory management. I was trying to play around a bit with the NSAutoreleasePool but somehow it wont release my object. I have a class with a setter and getter which basically sets a NSString *name. After releasing the pool I tried to NSLog the object and it still works but I guess...

How do I start up an NSRunLoop, and ensure that it has an NSAutoreleasePool that gets emptied?

I have a "sync" task that relies on several "sub-tasks", which include asynchronous network operations, but which all require access to a single NSManagedObjectContext. Due to the threading requirements of NSManagedObjectContexts, I need every one of these sub-tasks to execute on the same thread. Due to the amount of processing being don...

iPhone: Problems releasing UIViewController in a multithreaded environment

Hi! I have a UIViewController and in that controller, i am fetching an image from a URL source. The image is fetched in a separate thread after which the user-interface is updated on the main thread. This controller is displayed as a page in a UIScrollView parent which is implemented to release controllers that are not in view anymore. ...

Application get crash while using NSAutoreleasepool inside MKMapview regionDidChangeAnimated method

Hi, i am working on a map application, in that i like to drop the pins (as in Zillow apps) when ever user change the map view. I am using following code code. i am try to load the xml data from server using NSAutoreleasepool to do the xml parsing in the background thread. (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL...

iPhone: Crash in Custom Autorelease Pool

My app is crashing when I try to post images in an HTTP request. I am trying to upload images to a server. The crash appears related to my autorelease pool because the crash is trapped at the [pool release] message. Here is the crash report: #0 0x326712f8 in prepareForMethodLookup () #1 0x3266cf5c in lookUpMethod () #2 0x32668f28 i...

iphone iOS4 breaking app

Hi all, I have an application that has been running fine since its launch over a year ago. I developed it with iphone iOS 2.2.1 originally and tested and kept selling it up until 3.2 without issues. Now it fails to launch with iOS4. the app uses a non standard size for a UIPickerView (I don't think that's the problem but just mention...