• 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: NSTableView: lifespan of objectValueForTableColumn object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView: lifespan of objectValueForTableColumn object?


  • Subject: Re: NSTableView: lifespan of objectValueForTableColumn object?
  • From: email@hidden (Andrew Demkin)
  • Date: Mon, 12 Aug 2002 17:44:18 -0700

At 2:26 PM 8/12/02, Guy Umbright wrote:

>What is the lifespan of an object returned for
>
> - tableView:objectValueForTableColumn:row: ?
>

The convention across all of Cocoa is that unless the message selector
indicates an explicit 'alloc' or 'copy', the caller does not assume
responsibility for releasing the returned value.

If your return value is generated "on-the-fly" from a database, you should
create and autorelease the value before returning it to the table. If it
needs to, the table should subsequently retain (and later release) the
value.

Dan Wood suggested that you implement a cache for recently accessed values.
The reason to do this is if there's a performance problem when creating the
values dynamically. It may turn out that you need the cache, but that's a
different consideration than your question concerning the object lifetimes.

HTH,
Andrew.
_______________________________________________
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: NSTableView: lifespan of objectValueForTableColumn object?
  • Next by Date: Re: modal alert sheets
  • Previous by thread: Re: NSTableView: lifespan of objectValueForTableColumn object?
  • Index(es):
    • Date
    • Thread