1000Memories / TMQuiltView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TMQuiltView memory leak

haitaoli opened this issue · comments

dealloc code releases _reusableViewsDictionary first, but then cleanupColumns code path will re-create the dictionary and leak all objects in it. The fix is to move cleanupColumns to the beginning of dealloc.

  • (void)dealloc {
    [_indexPaths release], _indexPaths = nil;
    [_reusableViewsDictionary release], _reusableViewsDictionary = nil;
    [_rowsToInsert release], _rowsToInsert = nil;
    [_rowsToDelete release], _rowsToDelete = nil;

    [self cleanupColumns]; <== leaks _reusableViewsDictionary

    [self removeGestureRecognizer:self.tapGestureRecognizer];
    [_tapGestureRecognizer release], _tapGestureRecognizer = nil;

    [super dealloc];
    }