-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
First of all, thank you for the great component, I have small tip about improving memory usage for the infinite grid.
I noticed huge memory usage while profiling an app. using the infinite grid view.
When you scroll the infinite grid, method
tileGridsFromMinX:toMaxX:
which adds/removes views from one side using either
[lastGrid removeFromSuperview] or [firstGrid removeFromSuperview]
in ARC env. [lastGrid removeFromSuperview] doesn't release the view.
Similar problem I encountered with CorePlot: https://groups.google.com/forum/#!searchin/coreplot-discuss/memory/coreplot-discuss/nWui9VjnMtQ/er2FO3o9syYJ
If you do:
lastGrid = [self.visibleGrids lastObject];
while (lastGrid.frame.origin.x > maximumVisibleX) {
[lastGrid removeFromSuperview];
[self.visibleGrids removeLastObject];
[self.gridReusableQueue addObject:lastGrid];
lastGrid = nil;
lastGrid = [self.visibleGrids lastObject];
}
Memory usage is much more efficient. I've tested it in instruments, without lastGrid = nil I can easily reach 60Mb after 30 seconds of scrolling, with the line it increases but very slowly stays around 15Mb.
Metadata
Metadata
Assignees
Labels
No labels