IssueRaiser

Dart/Flutter never release memory of "Dart/Flutter Native" leading to OOM crash

# Problem Recently I encounter some crashs on an app because it was Out Of Memory. After some digging with DevTools I quickly found that a scrollable list of images was filling anormaly the memory. After some testing I have the feeling that pictures are remove from "**Dart/Flutter**" cache but are never release from "**Dart/Flutter Native**" memory. I've tried to use **cacheWidth** and **cacheHeight** parameters but same issue the memory never empty itself. I've tried **cached_network_image** package but the same issue occurs with the fact that it fills up faster the memory since the images are cached. I've tried also to download the content of pictures (Uint8List) to display with **Image.memory** but same issue occurs. This behaviors confort me that the problem is based on the ListView keeping rasterize children in memory or something like this. On this graph we can see the evolution of the "**Dart/Flutter Native**" that increase constantly without decreasing in contrary of the "**Dart/Flutter**" that manage smarter the memory consumption. ![Graph](https://user-images.githubusercontent.com/38684083/163982250-da09f6c8-0190-4b3f-af36-15af1cb90da7.png) On the **Analysis** and **Allocations** tab we can see that the **_List** class is instantiate a large number of times causing to use a lot's of bytes. ![Analysis](https://user-images.githubusercontent.com/38684083/163982726-6ccab558-7019-4b39-9b97-5b94193d4117.png) ![Allocations](https://user-images.githubusercontent.com/386

Posted by NeroThroN on Apr 19, 2022, 11:42 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

reliability (SaaS)

Dart/Flutter never release memory of "Dart/Flutter Native" leading to OOM crash

NeroThroNApr 19, 2022, 11:42 AM

# Problem Recently I encounter some crashs on an app because it was Out Of Memory. After some digging with DevTools I quickly found that a scrollable list of images was filling anormaly the memory. After some testing I have the feeling that pictures are remove from "**Dart/Flutter**" cache but are never release from "**Dart/Flutter Native**" memory. I've tried to use **cacheWidth** and **cacheHeight** parameters but same issue the memory never empty itself. I've tried **cached_network_image** package but the same issue occurs with the fact that it fills up faster the memory since the images are cached. I've tried also to download the content of pictures (Uint8List) to display with **Image.memory** but same issue occurs. This behaviors confort me that the problem is based on the ListView keeping rasterize children in memory or something like this. On this graph we can see the evolution of the "**Dart/Flutter Native**" that increase constantly without decreasing in contrary of the "**Dart/Flutter**" that manage smarter the memory consumption. ![Graph](https://user-images.githubusercontent.com/38684083/163982250-da09f6c8-0190-4b3f-af36-15af1cb90da7.png) On the **Analysis** and **Allocations** tab we can see that the **_List** class is instantiate a large number of times causing to use a lot's of bytes. ![Analysis](https://user-images.githubusercontent.com/38684083/163982726-6ccab558-7019-4b39-9b97-5b94193d4117.png) ![Allocations](https://user-images.githubusercontent.com/386

Comments (0)

No comments yet. Start the discussion.

Comment on this issue