• 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: Bound array item is repeatedly copied and collected while scrolling table view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bound array item is repeatedly copied and collected while scrolling table view


  • Subject: Re: Bound array item is repeatedly copied and collected while scrolling table view
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 7 Jul 2009 21:24:28 +0200


Le 7 juil. 09 à 14:24, Rick Hoge a écrit :


I have a nib file in which entries in an NSTableView are bound to an NSMutableArray via an NSArrayController. It is used in an application running under garbage collection.


The array items are NSDictionaries, and one of these dictionaries contains a large dataset object that consumes a lot of memory. I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected.

This might have something to do with the way that proxy objects are used by the array controller, or perhaps it is because the 'dataset' object is itself an entry in one of the table columns (presenting the string generated by the default 'description' method). Either way, this is detrimental to performance and memory footprint since these objects are huge (and I wouldn't normally have expected or wanted them to be copied).

Is there any way to control this behavior, for example forcing the actual object to be used instead of these transient copies?

Failing that, I am wondering (yes, I know this is ugly) if there is a way to set up some kind of context flag so that my object's 'copy' methods will just return a lightweight proxy when being called in this kind of situation (copied as part of a dictionary that is itself being copied)? The 'dataset' object implements both mutable and immutable copying. It is the 'immutable' copy method that is called during table scrolling.

Thanks for any insight someone can offer,

Rick


NSCells used to display table content copies the object it display. Instead of binding the cell value to your object directly, bind it to its description or an other relevant property.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Bound array item is repeatedly copied and collected while scrolling table view
      • From: Rick Hoge <email@hidden>
References: 
 >Bound array item is repeatedly copied and collected while scrolling table view (From: Rick Hoge <email@hidden>)

  • Prev by Date: Re: Bound array item is repeatedly copied and collected while scrolling table view
  • Next by Date: Re: Bound array item is repeatedly copied and collected while scrolling table view
  • Previous by thread: Re: Bound array item is repeatedly copied and collected while scrolling table view
  • Next by thread: Re: Bound array item is repeatedly copied and collected while scrolling table view
  • Index(es):
    • Date
    • Thread