• 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: [[object autorelease] release]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [[object autorelease] release]


  • Subject: Re: [[object autorelease] release]
  • From: Brant Vasilieff <email@hidden>
  • Date: Tue, 2 Oct 2001 11:13:42 -0700

On Tuesday, October 2, 2001, at 07:05 AM, cocoa-dev-
email@hidden wrote:

I think the original question was why does it crash when you release
an autorelease object. I suggest, along with others that
NSAutoreleasePool check to see if an object in its pool has already
been released before it releases it. I see no problem with this, as
the functions to check if an object has been freed exists, and in
fact, you can make it ok to release an autorelease object if you set
NSAutoreleaseFreedObjectCheckEnabled to true as an environmental
variable, or call

[NSAutoreleasePool enableFreedObjectCheck:YES];

then it should not crash if you release an autoreleased object if I
am reading the headers correctly, but unfortunately it doesn't seem
to work.

The problem with that test, is it only works in debug, if you've told it not to free deallocated objects. Objects that are freed are marked as dead, and further attempts to free them fail. However, you can't run very long this way, as you chew up memory. Otherwise, the test is unreliable, because the objects memory address could be reallocated to another object instead, and return that the object was valid when it shouldn't have been.

Cheers,
Brant


  • Prev by Date: Re: 10.1 dev tools are now online
  • Next by Date: Still that bug in Cocoa/10.1
  • Previous by thread: Re: [[object autorelease] release]
  • Next by thread: NSWindow hax0r
  • Index(es):
    • Date
    • Thread