3
java.lang.OutOfMemoryError: Failed to allocate a 1022304 byte allocation with 16777216 free bytes and 464MB until OOM
 1  at  java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
 2  at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:146)
 3  at java.lang.StringBuilder.append(StringBuilder.java:216)

I am running into a bug in Android 5.0, where our app crashes for a lot of users. However, the out of memory exception is very weird and happens only on Android 5.0+. The same app runs fine on all versions below 5.0.

How could it be that a OOM occurs, when allocating 1MB with 16MB free bytes and 464MB until OOM ???

Peterdk
  • 14,529
  • 18
  • 97
  • 136
  • http://stackoverflow.com/questions/3770457/what-is-memory-fragmentation – Akshit Rewari Apr 22 '15 at 18:27
  • 1
    I'm not sure whether a [compacting gc](http://en.wikipedia.org/wiki/Mark-compact_algorithm) was already added to Android, the error (at least theoretically) could be explained with a high heap fragmentation. – Droidman Apr 22 '15 at 18:27
  • 1
    The classic symptom of memory fragmentation is that you try to allocate a large block and you can't, even though you appear to have enough memory free. – Akshit Rewari Apr 22 '15 at 18:27
  • @Droidman My mistake , I didn't read that part. Anyways I'm wasn't sure about the issue which is why I wrote it as a comment and not an answer – Akshit Rewari Apr 22 '15 at 18:33
  • I am running into the same issue when I try to convert date(long) from database to readable string. Any leads on resolving it? – Ishaan Jul 10 '16 at 06:54

0 Answers0