Quick memory management question


i have quick memory management question. here code:

code:
nsarray *keys = [[[nsarray alloc] initwithobjects: @"1", @"2",nil] autorelease];	  	  nsmutablearray * temp = [[nsmutablearray alloc] init];  	  temp = [nsmutablearray arraywitharray:keys];  	  [temp release];
when release temp object, app crashes. if remove line, runs, of course leak memory.

i've been looking through documentation hours , i've looked @ countless examples , can't figure out why crashes. alloc object, it, release it. i've written conforms documentation, far understand it. missing here?
 

what "doing" other reassigning right away, throws out alloc'd? causing leak.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments