Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sean Kim

macrumors newbie
Original poster
Jun 9, 2011
5
0
there is no error or warning during compile.
but I get error messages while running.

"... of class NSCFData autoreleased with no pool in place - just leaking"

I wrote the code exactly same as the tutorial
http://www.otierney.net/objective-c.html#dealloc

I know there is memory management solution called autorelease.
but my code doesn't have any autorelease object

thanks

system info:
i686-apple-darwin10-gcc-4.2.1
mac osx 10.6.7
 
Is your main like this?

Code:
int main(int argc, const char* argv[]) {
  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

  //  Actual program here

  [pool drain];
  return 0;
}
 
I know there is memory management solution called autorelease.
but my code doesn't have any autorelease object

Just because you don't autorelease any object does not mean that there are no autoreleased object. Any of the convenience constructors will return an autoreleased object. In fact pretty much any method in the Foundation and Cocoa APIs that returns an object that is not a new/alloc/init/copy method will return an autoreleased object.

So basically you should always have an autorelease pool for every single thread (this may not be true if you are running with GC though).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.