Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

The cell in ASTableNode, ASCollectionNode never dealloc, when number of cells increase, the memory increases all the time. #3231

Closed
ghost opened this issue Mar 30, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2017

Firstly, thank you very much for creating such amazing framework, it's really so smooth, so fluent.

When I use ASTableNode/ASCollectionNode, I encountered a memory issue, with the new cell creating, the memory cost will be higher and higher, finally crash the app.

I uses the Facebook official CatDealsCollectionView sample to test the ASTableNode ASCollectionNode memory issue. Finally I found the cells are never dealloc, eg. we have 10,000 cells, ASTableNode will create 10,000 cells, and these cells are both in memory.

When you scroll down the cells, the memory will increase a little by a little. If you scroll down and down, the memory cost will reach up several hundred, even over 1 GB, then crash.

When you scroll down to several thousands cells, then let the iPhone rotate to landscape, the whole table node will block for several seconds, then layout finished, it recovered, then scroll down again, it is still smooth.

But when memory cost 1.3GB, the app crashed.

CatDealsCollectionView.zip
img_0133

https://github.com/evanxie-cn/AsyncDisplayKit/blob/master/MemoryCrash.MOV

@Ruanjijian
Copy link

+1
Same issue occurred to me with version 2.1
All Heap & Anonymous VM Have been increasing

@ghost
Copy link
Author

ghost commented Mar 30, 2017

I tested on the SDK 2.1, and 2.2, both have this issue.

@Adlai-Holler
Copy link
Contributor

Adlai-Holler commented Apr 3, 2017

@appleguy I know you are crazy busy but I think you're the man to investigate this very serious issue, as the rest of the team is heads-down on other tasks.

@maicki investigated and he found that CoreGraphics is caching CGImages without us asking for it to. We need to prevent this behavior!

EDIT: As context for everyone, it's not the cell nodes that are the core memory issue. It's intended for all 10,000 nodes to stay alive – a node only takes up a tiny amount of memory. The real cost is the CGImages that the nodes set as layer.contents which are cleared – and expected to be destroyed – when the node exits the display range (-clearContents) method. This behavior suggests that those images are not being deallocated as expected.

@ghost
Copy link
Author

ghost commented Apr 25, 2017

@Adlai-Holler Thanks for your explanation and team hard work. So, maybe we just wait for this issue resolved, right?

@garrettmoon
Copy link
Contributor

This issue was moved to TextureGroup/Texture#211

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants