OutOfMemoryError what to increase and how?

前端 未结 2 1009
星月不相逢
星月不相逢 2020-12-16 00:53

I have a really long collection with 10k items, and when running a toString() on the object it crashes. I need to use this output somehow.

05-21 12:59:44.586         


        
相关标签:
2条回答
  • 2020-12-16 01:11

    If you need to output a string with that size try to write it into a file on the SD-Card. That is the only way I can think of to get this string out of your app. If you append the items one by one to the file you want need that much memory.

    0 讨论(0)
  • 2020-12-16 01:23

    It seems that there is a hard limit of 16 MB heap space on Android apps that can only be worked around by altering the Android source. Your program has hit this limit: "Out of memory: Heap Size=15559KB". You'll need to figure out how to reduce your program's memory usage. A nice guide to doing this is here.

    0 讨论(0)
提交回复
热议问题