• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does this keep sending EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does this keep sending EXC_BAD_ACCESS


  • Subject: Re: Why does this keep sending EXC_BAD_ACCESS
  • From: Gorazd Krosl <email@hidden>
  • Date: Tue, 30 Mar 2004 13:29:16 -0500 (EST)

Angel,
Both, your serverWindos and chanellWindws get
released:

>> serverWindows = [[NSMutableArray
arrayWithCapacity:5] autorelease];

After this line your serverWindows array has retain
count of 1 and 2 pending autorelease events. Question:
Why are you using "convenience" initializer and why
are you sending additional autorelease message?

>> [serverWindows retain];
After this line is executed, retain count of
serverWindows is 2. When autorelease pool is
deallocated after current event loop, your
serverWindows will be released (retain count = 2 - 2
autorelease calls) == 0.

I would write:
serverWindows = [[NSMutableArray alloc]
initWithCapacity:5];
This gives you object with retain count of 1 that you
release as needed with [serverWindows release].

The same applays for channelWindows.

HTH
Gorazd


______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Changing subviews during drawing
  • Next by Date: Re: Why does this keep sending EXC_BAD_ACCESS
  • Previous by thread: Re: Why does this keep sending EXC_BAD_ACCESS
  • Next by thread: Changing subviews during drawing
  • Index(es):
    • Date
    • Thread