screenrecorder icon indicating copy to clipboard operation
screenrecorder copied to clipboard

[Memory Usage]: Add dispose() method for freeing memory used by `ui.Image` objects

Open okmanideep opened this issue 9 months ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Package/Plugin version

0.3.0

What you'd like to happen

ScreenRecorderController.dispose() invokes Exporter.dispose() which internally calls dispose on each ui.Image objects being referred to Frame.image.dipose().

A class or method that receives an image object must call dispose on the handle when it is no longer needed.

Image | dart:ui | Documentation

Alternatives you've considered

Calls to .export() automatically disposes the Images. This might be ok, but it's a call between implicit vs explicit.

Implicit -> Good behaviour for all consumers Explicit -> More control and clarity

Even in the case of implicit, it's better to give the option to dispose without needing to export

okmanideep avatar Mar 26 '25 12:03 okmanideep