简体   繁体   English

Android上ParseObject的ArrayList的良好内存大小

[英]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. 我有一个ParseObject的子类,其中包含13个public static String成员,30个getter和setter以及三个其他方法。

@ParseClassName("Mine") public class Mine extends ParseObject{ ... } @ParseClassName(“ Mine”)公共类Mine扩展了ParseObject {...}

How many of these objects is reasonable to keep in memory in an ArrayList for an android adapter? 这些对象中有多少个合理,可以在android适配器的ArrayList中保留在内存中?

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

What if one of my getters returned a bitmap loaded from a ParseFile? 如果我的一个吸气剂返回了从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. 您可能需要使用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. 您可以创建一些测试,在其中将对象加载到ArrayList ,然后必须注意内存消耗和其他相关数据。

As from the docs, Memory Monitor is good for: 从文档开始,Memory Monitor适用于:

  • 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. 这是Android Studios内存监视器上的图像。

内存监视器

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 . PS:请记住,这个答案取决于您所使用的设备以及手机的内存量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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