Modified FlautoRecorderEngine.java to re-use buffers and avoid GC churn#17
Open
781flyingdutchman wants to merge 6 commits intoCanardoux:masterfrom
Open
Modified FlautoRecorderEngine.java to re-use buffers and avoid GC churn#17781flyingdutchman wants to merge 6 commits intoCanardoux:masterfrom
781flyingdutchman wants to merge 6 commits intoCanardoux:masterfrom
Conversation
…e Collection churn
|
+1 to this issue. Frequent GC causes app jitter and (now that flutter has merged the platform and UI threads) it's even more of a performance issue |
…d but data is still feeding in
…ent crashes like IllegalState when the feed is terminated
Author
|
Following the initial commit to this PR I have made further changes to address runtime errors in both Android and iOS code bases, that caused app crashes for various reasons. Still not 100% convinced all nullpointer issues in iOS are fixed, but I do think it is getting better |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, really appreciate your flutter_sound package, but per this issue when using the
toStreamoption it generates massive Garbage Collection churn on Android, see this log:That is 604MB collected, causing 107ms of blocked Alloc in less than 1 second (and it goes on forever).
The reason is that in
FlautoRecorderEngine.javayou allocate buffers within a tight loop. I did not have time to look into this in detail, but this PR modifiesFlautoRecorderEngine.javato use a re-usable buffer that does not have to be allocated frequently, and as a result the blocking GC Alloc calls are gone completely.Because flutter_sound depends on this repo it is hard to make the change there, but perhaps you can adopt the changes in this PR (or something similar) so that the flutter_sound package becomes much more performant on Android.
Thanks!