KKGridView icon indicating copy to clipboard operation
KKGridView copied to clipboard

Potential Memory Issue with New Cell Recycling Implementation

Open kolinkrewinkel opened this issue 12 years ago • 8 comments

If we're not removing them, and just hiding them, aren't we creating potential to just recreate new cells and create an infinite stack?

kolinkrewinkel avatar Apr 04 '12 04:04 kolinkrewinkel

@zadr?

jonsterling avatar Apr 04 '12 04:04 jonsterling

I haven't noticed any memory issues when using this code. The point of reuse is to keep cells around for the duration of the gridview, anyway. It's rare for a cell to go away before the gridview does.

If you like, I can add some logic on cell deletion (and low memory warnings, probably) to check to see if the total # of cells we have is less than the number of cells on screen, and remove unused cells as necessary. My thought for not doing this in the first place was that if we needed these cells in the first place, we will likely need them again.

zadr avatar Apr 04 '12 04:04 zadr

I think before we move onto the removal/hidden thing, there's some sort of logic error with the cell recycling, as pointed out to me by several people (with cells lingering around after they were supposed to have been removed.)

kolinkrewinkel avatar Apr 04 '12 04:04 kolinkrewinkel

Yeah, I made a comment on ticket #129, and saw Jon's comment on #127. Looking into it now. Wondering how I didn't notice this before, as well.

zadr avatar Apr 04 '12 04:04 zadr

Yeah, it's visible with cells with variable content and translucent content. Not really sure why, as it was bulletproof from what I could tell, even through @Gi-lo's testing.

kolinkrewinkel avatar Apr 04 '12 04:04 kolinkrewinkel

Could it have been a problem with my merge picking the wrong thing?

zadr avatar Apr 04 '12 04:04 zadr

No, I got these reports before the merge.

kolinkrewinkel avatar Apr 04 '12 04:04 kolinkrewinkel

This (memory) should be addressed by https://github.com/kolinkrewinkel/KKGridView/pull/130

zadr avatar Apr 04 '12 04:04 zadr