News for hackers. Stuff that matters.
Re:My first six months of programming: from man-rodent to pa... by fbu on Wednesday April 13, 2011 @02:50PM (#2443597)
Isn't there a huge memory leak? Creating a new pointer on each iteration without keeping track of them.

I might be wrong I've been doing games in CL for some time now.

Re:My first six months of programming: from man-rodent to pa... by teaspoon on Wednesday April 13, 2011 @04:32PM (#2444057)
With a few exceptions, pointers returned by methods in Objective-C are assumed to be autoreleased. That means their reference count will be decremented at the end of the event loop.

But if OP is expecting a lifetime of learning, he might want to push a new autorelease pool for each iteration.

Re:My first six months of programming: from man-rodent to pa... by mbenjaminsmith on Thursday April 14, 2011 @01:23AM (#2445741)
Or just release it. If you're sure it's autoreleased then retain/release it. If you're not sure, just set it to autorelease before you retain/release it.
Re:My first six months of programming: from man-rodent to pa... by othermaciej on Thursday April 14, 2011 @02:37AM (#2445892)
retain/release on an autoreleased object won't make it get destroyed any faster. You still have to wait for the event loop to cycle (or push/pop your own autorelease pool).
Re:My first six months of programming: from man-rodent to pa... by mbenjaminsmith on Saturday April 16, 2011 @03:29AM (#2453478)
That's correct. That's something I read, have repeated but never bothered to actually test.
Re:My first six months of programming: from man-rodent to pa... by muhfuhkuh on Wednesday April 13, 2011 @09:36PM (#2445065)
Assuming that's in his init method, he left

-(void) dealloc {

  self.newProgram = nil;
}

as an exercise for the reader.