views:

352

answers:

3

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 autoreleased with no pool in place - just leaking
Stack: (0x305a2e6f 0x30504682 0x52c14d 0x536f67 0x3058deff 0xb049 0xa554 0x3050a79d 0x3050a338 0x97181155 0x97181012)

can anyone help me?

Thanks in advance....

+1  A: 

Your pool allocation and release code looks fine. The error message, nevertheless, indicates something was allocated with autorelease outside the scope of an autorelease pool. This often happens in when you use a secondary thread, when using some specialty load methods, and when initializing globals.

Once you isolate the leaking bit of code, you could try wrapping it by another set of NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; and [pool release];.

Oren Trutner
+1  A: 

That message occurs when an object is sent the autorelease message outside of an autorelease scope. Place a breakpoint on _NSAutoreleaseNoPool and check the stack to see where the pool needs to be added.

rpetrich
A: 

Look for any place in your code where you make autoreleased objects, while inside another thread than your main run loop.

mahboudz
Thanks i found that