I got the following strange crash report for Android app from Google Play (pay attention to the amount of placement and available free space) -
java.lang.OutOfMemoryError: Failed to allocate a 16396 byte allocation with 5746272 free bytes and 111MB until OOM at com.android.internal.util.FastXmlSerializer.<init>(FastXmlSerializer.java:55) at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:183) at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:597) at android.app.SharedPreferencesImpl.access$800(SharedPreferencesImpl.java:51) at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:512) at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:533) at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:51) at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:455) at com.headuck.headuckblocker.bj.a(Unknown Source) at com.headuck.headuckblocker.UpdateService.e(Unknown Source) at com.headuck.headuckblocker.UpdateService.a(Unknown Source) at xaonHandleIntent(Unknown Source) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.os.HandlerThread.run(HandlerThread.java:61)
I am aware of a number of OutOfMemoryError issues for SO, but it seems that none of them are caused by a byte allocation much smaller than the available free space.
A user used the Galaxy S5 on Android 5.0 and reported that such crashes occur during games (and which games do not matter), which I perceive is repeated every time he uses another application with intensive memory in the foreground and background service my application. As a Google Play talk, I have no other means to get more details.
My question is, what could lead to this happening, and any measures that the application can take to avoid this?
Some background (in case it matters): the aforementioned failure refers to the periodically scheduled background service of my application, which does not include any UI / bitmap. All he does is download data from the server and update the database / status. It worked without any problems in 5-year-old machines with much less RAM and should be very light in memory by the standards of modern Android phones. The above instance of the error occurs when the database is updated, and the service writes the updated status to the general configuration.
Edit: just read OutOfMemoryError in android when distributing 4Mb, when 10Mb is free , which was related to this issue after publication, but it just seems incredible that the free space available can be so fragmented in this case? Is there any other reason?
source share