I have an Android Service that can be running for 1 - 2 hours at the time. Currently this app is in its debugging stage. While the service is running I randomly get this error:
F/art ( 2816): art/runtime/indirect_reference_table.cc:86] Check failed: slot_mem_map_.get() != nullptr Failed anonymous mmap(0x0, 12288, 0x3, 0x2, 32, 0): Operation not permitted
...
+ hundreds of lines that belongs to this message regarding the same `indirect_reference_table.cc`.
So to me it seems like I am running out of memory somehow. The only thing I can think about is the writing of the logcat to a file on the SDcard. This is a process I start in the onStartCommand of the service and which I destroy in onDestroy. Like the following:
private Process process;
public int onStartCommand(Intent intent, int flags, int startId) {
...
File appDirectory = new File( Environment.getExternalStorageDirectory() + "/Log" );
File logFile = new File( appDirectory, "logcat.txt" );
if (!appDirectory.exists() && !appDirectory.mkdir())
Log.e("Tag", "Not possible to write file");
try {
process = Runtime.getRuntime().exec("logcat -f " + logFile);
} catch (IOException e) {
e.printStackTrace();
}
return Service.START_STICKY;
}
@Override
public void onDestroy() {
...
process.destroy();
super.onDestroy();
}
Can anyone say of this error depends on running out of memory because mainly of the logcat? And/or have a solution to fix this as this crash kills my service?