AQGridView icon indicating copy to clipboard operation
AQGridView copied to clipboard

Leaks When Calling reloadData

Open sandersnewmedia opened this issue 13 years ago • 9 comments

I created a new project to isolate the issue - see the implementation for this: https://gist.github.com/ee3d7b2204d2f4b9a214

As soon as reloadData is called there are two immediate leaks in -[AQGridView(AQCellLayout) updateVisibleGridCellsNow](li 1544).

sandersnewmedia avatar Dec 16 '11 19:12 sandersnewmedia

Hm, might have cropped up due to ARC migration. Right now I don't see anything wrong with the code-- presumably the ARC handler isn't correctly placing the calls to deallocate everything. Can you confirm that no exceptions are being caught in that method?

AlanQuatermain avatar Dec 16 '11 19:12 AlanQuatermain

Setting a breakpoint in the @catch block and adding a logger statement yielded no result. It doesn't seem to be catching anything. I can send a zip of the test project if that would be helpful.

sandersnewmedia avatar Dec 16 '11 19:12 sandersnewmedia

That's okay— I'll take a look later on today.

AlanQuatermain avatar Dec 16 '11 19:12 AlanQuatermain

Hello, I just upgraded to version 1.2 and I experience the same problems on calling reloadData. If selection is enabled the application crashes on reloadData, if selection is disabled (with cell.selectionStyle = AQGridViewCellSelectionStyleNone) the application does not crashes but there are memory leaks. In version 1.1 there was no problem in reloadData (I upgraded to version 1.2 because gridFooterView doesn't work well in 1.1 in landscape mode). Is there any solution? I'm a newbie in iOS programming, but can I help in some way?

Andrea

PS: Analyze in XCode gives many potential leaks in AQGridView.m and AQGridViewAnimatorItem.m

apierini avatar Jan 24 '12 17:01 apierini

I've noticed the same crashing problem (EXC_BAD_ACCESS) as apierini except it only happens to me if the grid is scrolling and I call reloadData - at least that is what appears to be happening as the first call to reloadData when the view loads doesn't cause a crash. The crash I get is in "resetHighlightForSubviewsOfView" on the line:

NSMutableDictionary * info = (NSMutableDictionary *) objc_unretainedObject(CFDictionaryGetValue( _selectionColorInfo, objc_unretainedPointer(view) ));

As stated above it doesn't crash if selection style is AQGridViewCellSelectionStyleNone.

Aaronov avatar Feb 05 '12 03:02 Aaronov

I have very similar issue on updateVisibleGridCellsNow and I am not using ARC. AQGridView leak NSIndexSet objects which are copied by mutableCopy method. It seems that it could be solved by adding autorelease call to all the copied object. I did so and now have no leak found on Instrument. I guess this issue happens only if not using ARC.

ghost avatar Feb 07 '12 14:02 ghost

I also encoutered the same crash as explained by @Aaronov and others.

I'm not using ARC, first call to reloadData goes well but each other call crashes the app (EXC_BAD_ACCESS). Using AQGridViewCellSelectionStyleNone fixed the problem for now.

yonicsurny avatar Mar 07 '12 10:03 yonicsurny

Yes, setting AQGridViewCellSelectionStyleNone fixed the problem for now.

mkarp avatar Mar 16 '12 13:03 mkarp

Running across a similar issue when just trying to set a selection style on my custom AQGridViewCells.

raid5 avatar Apr 22 '12 22:04 raid5