简体   繁体   中英

Good in-memory size of ArrayList of ParseObject on android

I have a subclass of ParseObject with 13 public static String members, 30 getters and setters combined and three other methods.

@ParseClassName("Mine") public class Mine extends ParseObject{ ... }

How many of these objects is reasonable to keep in memory in an ArrayList for an android adapter?

ArrayList<Mine> mineList;//size 30? 300? 1000?

What if one of my getters returned a bitmap loaded from a ParseFile? as in

Bitmap getBitmap(String parseFilekey){
  ParseFile file = getParseFile(parseFileKey);
  return getBitmap(file);
}

That's probably something you'll have to benchmark yourself using the tools that come with Android Studio.

You can create a few tests where you load your objects into your ArrayList , and then you'll have to keep an eye on memory consumption and other relevant data.

As from the docs, Memory Monitor is good for:

  • Showing available and used memory in a graph, and garbage collection events over time.
  • Quickly testing whether app slowness might be related to excessive garbage collection events.
  • Quickly testing whether app crashes may be related to running out of memory.

Otherwise I don't think we can give you a precise answer.

Here's an image on Android Studios Memory Monitor.

内存监视器

You can read on how to use it here on this link .

PS: Keep in mind that this answer depends on what device you're using, and how much RAM the phone have .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM