yang-f / flutter_svg_provider

Use svg as image provider.
https://pub.dev/packages/flutter_svg_provider
Apache License 2.0
44 stars 70 forks source link

Memory leaks #65

Open darkstarx opened 1 month ago

darkstarx commented 1 month ago

Hi! You use vg.loadPicture in the _loadAsync method and you must call Picture.dispose when you are done with the pictureInfo.picture. But I don't see in your code any mention of disposing.

An Image widget using your Svg ImageProvider gets from the provider an ImageInfo with the ui.Image taken from pictureInfo.picture.toImage, and when the Image widget is done, it calls ui.Image.dispose but not Picture.dispose, so all resources of the Picture used for rasterizing the image stay in memory.

joukhar commented 1 week ago

i created a pull request for it: https://github.com/yang-f/flutter_svg_provider/pull/66

darkstarx commented 1 week ago

Looks good, thanks.