iOS/iPad OS Bad Alloc/Not Enough Memory Available
In iOS or iPad devices with little available memory, or where you have a memory-intensive application that uses multiple realms or many notifications, you may encounter the following error:
libc++abi: terminating due to an uncaught exception of type std::bad_alloc: std::bad_alloc
Este error normalmente indica que un recurso no se puede asignar porque no hay suficiente memoria disponible.
Si está compilando para iOS 15+ o iPad 15+, puede agregar el Derecho de direccionamiento virtual extendido para resolver este problema.
Add these keys to your Property List, and set the values to true:
<key>com.apple.developer.kernel.extended-virtual-addressing</key> <true/> <key>com.apple.developer.kernel.increased-memory-limit</key> <true/>
Use in System Apps on Custom Android ROMs
Atlas Device SDKs use named pipes to support notifications and access to the Realm file from multiple processes. While this is allowed by default for normal user apps, it is disallowed for system apps.
System apps are defined by setting android:sharedUserId="android.uid.system" in the Android manifest. For system apps, you may see a security violation in Logcat that looks something like this:
05-24 14:08:08.984 6921 6921 W .realmsystemapp: type=1400 audit(0.0:99): avc: denied { write } for name="realm.testapp.com.realmsystemapp-Bfqpnjj4mUvxWtfMcOXBCA==" dev="vdc" ino=14660 scontext=u:r:system_app:s0 tcontext=u:object_r:apk_data_file:s0 tclass=dir permissive=0 05-24 14:08:08.984 6921 6921 W .realmsystemapp: type=1400 audit(0.0:100): avc: denied { write } for name="realm.testapp.com.realmsystemapp-Bfqpnjj4mUvxWtfMcOXBCA==" dev="vdc" ino=14660 scontext=u:r:system_app:s0 tcontext=u:object_r:apk_data_file:s0 tclass=dir permissive=0
To fix this, you need to adjust the SELinux security rules in the ROM. This can be done by using the tool audit2allow. This tool ships as part of AOSP.
Extraiga la política actual del dispositivo:
adb pull /sys/fs/selinux/policy.Copy the SELinux error inside a text file called
input.txt.Ejecute la herramienta
audit2allow:audit2allow -p policy -i input.txt.La herramienta debería mostrar una regla que puedes agregar a tu política existente. La regla te permite acceder al archivo Realm desde múltiples procesos.
audit2allow Se genera al compilar AOSP/ROM y solo se ejecuta en Linux. Consulta los detalles en la documentación de Android Source. También ten en cuenta que, desde Android Oreo, Google cambió la configuración de SELinux y las políticas de seguridad predeterminadas ahora están más modularizadas. Más detalles en la documentación de Android Source.