Cannot allocate memory android

What version of Go are you using (go version)?


What operating system are you using?

Android 11

What version of Badger are you using?


Does this issue reproduce with the latest master?


What Badger options were set?

options := badger.DefaultOptions(filename)
options.InMemory = false

What did you do?

Ran badger on android 11 with default configuration.

Error message:

2022-08-15 04:28:43.771 29205-29256/ E/GoLog: badger 2022/08/15 03:28:43 ERROR: Received err: Open existing file: "/storage/emulated/0/Documents/data/blockchain_main//000001.vlog" error: while opening file: /storage/emulated/0/Documents/data/blockchain_main//000001.vlog error: cannot allocate memory
2022-08-15 04:28:43.771 29205-29256/ E/GoLog: while mmapping /storage/emulated/0/Documents/data/blockchain_main//000001.vlog with size: 2147483646

Android is a platform that was never thought to be supported.


The error shows badger is trying open a 2GB file in /storage/emulated/… Have you tried to set the file location to a place in which you may be able to allocate that amount of space?

Is there anyway to reduce the file size when created in the config ?
Thanks !

Check out this discussion which details options to control file size: