Repository navigation
Fix Android OOM in file-based signing - #5
Merged
redaranj merged 2 commits intoMar 7, 2026
Merged
Conversation
Replace readBytes() + ByteArrayStream with FileStream in 5 file-based code paths. FileStream streams from disk via RandomAccessFile instead of loading entire files into JVM heap. Add OOM regression test that simulates production conditions by filling JVM heap via test helper, then signing a 15MB MP4. Fixes guardianproject#4
Member
|
Submitting this fix into Divine now |
Member
|
Also, @redaranj we should review the iOS code for any similar issues... will try to get to that today. |
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.
Summary
Replace
readBytes()+ByteArrayStreamwithFileStreamin 5 file-based code paths.FileStreamstreams from disk viaRandomAccessFileinstead of loading entire files into JVM heap.Fixes #4
Problem
30 OOM crashes in production. After video capture and editing, the JVM heap is nearly full.
readBytes()tries to load the video file into memory and fails — even for small files (7-16MB).Test
Added a regression test that simulates production conditions: fills the JVM heap via a test helper method channel, then signs a 15MB MP4. Crashes without the fix, passes with it.