Re: Bound array item is repeatedly copied and collected while scrolling table view
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: Rick Hoge <email@hidden>
- Date: Tue, 7 Jul 2009 14:26:46 -0400
...
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.
....
It's not the table view's fault.
What generates the description for the data set? You wrote a
'description' method? How long is the string it returns?
If the property to which a table column is bound has the "copy"
attribute, then the value will indeed be copied every time the table
view fetches a value for the column. Does you "large dataset object"
support NSCopying? However, since you've chosen to use dictionary
instead of real properties, this seems unlikely to be the cause of
your problem, unless there's more you haven't told us.
My bet's on a giant description string the size of Manhattan.
No - I don't override 'description' for my dataset class. The string
<NLVolumeDataset: 0x8000d81a0> presumably generated by NSObject's
description method is displayed.
My NLVolumeDataset does indeed support both NSCopying and
NSMutableCopying. I know that this class's copyWithZone: method is
called, and then very shortly thereafter 'finalize' is called. So it
(the NSArrayController?) just seems to be firing off these huge copies
so that it can call 'description' on them to display in the table,
then discarding them.
I agree it's not the table view's fault - it's just that even
scrolling the table slightly so that the NLVolumeDataset entry comes
in and out of view leads to the generation of large numbers of new
copies.
Thanks for the comments,
Rick
_______________________________________________
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
(43092.6825)
_______________________________________________
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