yang-f / flutter_svg_provider

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

Memory leaks #65

Open darkstarx opened 5 months ago

darkstarx commented 5 months 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 4 months ago

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

darkstarx commented 4 months ago

Looks good, thanks.