java - Keep getting an out of memory error when fetching many items on startup -
i fetching logged in user's likes parse database. when query, outofmemoryerror:
java.lang.outofmemoryerror: failed allocate 78089518 byte allocation 16777216 free bytes , 26mb until oom @ java.lang.string.<init>(string.java:332) @ java.lang.string.<init>(string.java:149) @ java.lang.string.<init>(string.java:119) @ com.parse.parserestcommand.onresponse(parserestcommand.java:176) @ com.parse.parserequest$3.then(parserequest.java:229) @ com.parse.parserequest$3.then(parserequest.java:225) @ bolts.task$14.run(task.java:796) @ bolts.boltsexecutors$immediateexecutor.execute(boltsexecutors.java:105) @ bolts.task.completeaftertask(task.java:787) @ bolts.task.continuewithtask(task.java:599) @ bolts.task.continuewithtask(task.java:610) @ bolts.task$12.then(task.java:702) @ bolts.task$12.then(task.java:690) @ bolts.task$14.run(task.java:796) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) @ java.lang.thread.run(thread.java:818)
the query doing looks this:
parsequery<like> query = parsequery.getquery(like.class); query.include("user"); query.setlimit(1000); query.whereequalto("user", parseuser.getcurrentuser()); query.adddescendingorder("createdat");
something note, if limit 100 fine. playing around limit seems throws error if limit more 600. thing note make similar call fetches 1000 items parse no problems @ all. seems tied exact query.
has else ran similar problem?
imho fetch much. included "user" entity perhaps quite big , fetch 1000 of them, looks wrong. have different way, fetch on demand or implement kind of "scrolling" on list of users. alternatively can fetch "user" properties enough particular case , rest loaded later.
query.include("user.id"); query.include("user.avatar");
Comments
Post a Comment