flutter_uploader icon indicating copy to clipboard operation
flutter_uploader copied to clipboard

Fix unbounded memory usage

Open trueb2 opened this issue 3 years ago • 1 comments

  • Prevents the event channels from sinking an event more than once
  • Removes UploadResultDatabase

The CacheStreamHandler and UploadResultDatabase would play hand in hand to continuously increase memory usage. After every init, the UploadResultDatabase would add into the CacheStreamHandler's cache every taskId and map pair ever processed since the last clearUploads. During app lifecycle, CacheStreamHandler would build up its cache on a per event basis. This means memory usage is always as big as all previous events' taskIds and metadata.

To me, the UploadResultDatabase doesn't serve any purpose. Arguably, this is a feature, not a bug. Since I have a listener installed at app init for results, I don't ever want a build up or recall of previous events. There is probably a less heavy handed approach for this, but this fixes my "memory leak" problems. https://github.com/fluttercommunity/flutter_uploader/issues/80

trueb2 avatar Dec 09 '21 20:12 trueb2

This may make the clearUploads interface useless for iOS

trueb2 avatar Dec 09 '21 20:12 trueb2