Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of memory allocations and OOM errors #226

Merged
merged 6 commits into from
Jul 5, 2024

Conversation

DanielJette
Copy link
Contributor

What does this change accomplish?

Parallel pixel processing requires the allocation of two byte buffers. For a typical device resolution of 1080 x 1920, two buffers of approximately 2 MB each (4 MB total) are allocated.

Most AVDs are configured with a heap size of 25% their available RAM. For example, 512 MB for a device with 2 GB of RAM. See: https://android.googlesource.com/platform/external/qemu/+/emu-master-dev/android/android-emu/android/main-common.c#1292

This is normally more than sufficient for parallel pixel processing. However, in some instances it has been observed where the heap size for androidTest instrumentation runners is set to only 16 MB, which is not sufficient for Testify. If you encounter this exception, please verify that your emulator is correctly configured with at least 2 GB of RAM.

Testify will now throw a LowMemoryException when attempts to allocate an IntBuffer fail. This can help users diagnose AVD configuration problems and reports on the state of the device.

@AndroidTestifyBot
Copy link
Contributor

AndroidTestifyBot commented Jun 29, 2024

✅ Success! - Legacy Sample screenshot test results

View build for commit 4809725

@AndroidTestifyBot
Copy link
Contributor

AndroidTestifyBot commented Jun 29, 2024

✅ Success! - Flix Sample screenshot test results

View build for commit 4809725

@AndroidTestifyBot
Copy link
Contributor

AndroidTestifyBot commented Jun 29, 2024

✅ Success! - Flix Library screenshot test results

View build for commit 4809725

@DanielJette DanielJette force-pushed the 2024-06-28-better_memory_handling branch from f6c0f3e to 12d41dd Compare June 29, 2024 21:53
@DanielJette DanielJette marked this pull request as ready for review June 29, 2024 22:20
@DanielJette DanielJette requested a review from a team June 29, 2024 22:20
@DanielJette DanielJette merged commit 7fab5af into main Jul 5, 2024
2 checks passed
@DanielJette DanielJette deleted the 2024-06-28-better_memory_handling branch July 5, 2024 16:57
jaredh added a commit that referenced this pull request Jul 8, 2024
Correct reference to issue #226 in 3.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants