Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ROOM OutOfMemoryError R(OOM)

I am seeing these errors in my play-console. Does anybody know how to best deal with OOM Errors in room?

java.lang.OutOfMemoryError: 
  at android.database.CursorWindow.nativeGetString (Native Method)
  at android.database.CursorWindow.getString (CursorWindow.java:451)
  at android.database.AbstractWindowedCursor.getString (AbstractWindowedCursor.java:51)
  at org.walleth.data.transactions.TransactionDAO_Impl$8.compute (TransactionDAO_Impl.java:1272)
  at org.walleth.data.transactions.TransactionDAO_Impl$8.compute (TransactionDAO_Impl.java:1212)
  at android.arch.lifecycle.ComputableLiveData$2.run (ComputableLiveData.java:87)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607)
  at java.lang.Thread.run (Thread.java:762)
like image 927
ligi Avatar asked Nov 25 '17 00:11

ligi


1 Answers

Are you transferring huge data at once?

If it is a list you are filling, you can do it lazily and get it 100 by 100 for example.

Also If your response from database has many columns, SELECT the ones that you use.

like image 93
Adib Faramarzi Avatar answered Oct 18 '22 04:10

Adib Faramarzi