flutter_uploader
flutter_uploader copied to clipboard
Fix unbounded memory usage
- 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
This may make the clearUploads interface useless for iOS