2

Good day, I've quite big project currently localized to 21 languages where one language has around 9000 words! This is not so interesting, but

  • compiled and started application with all these resources, took after start around 11 MB in memory (simply measured by Debug.getNativeHeapSize())

  • when I remove 20 languages and keep only default one, it has after start only 7.5 MB

Because biggest problem of my app are devices with low memory available for a single process (mainly older devices with 2.X android), this is very serious question for me.

So here comes two questions, hope that someone will have any useful suggestion

  1. I expect that Android loads only required resources, so how it's possible that these additional languages makes so huge difference, when in memory should be in worst case just list of available resources

  2. if there is not any explanation for point 1., is there any way to precompile resources into separate packages and download them on request? For example in some starting activity where user select language he wants to use?

any suggestions are more then welcome. Thanks

4

1 回答 1

0

Android 上的内存测量让人想起Zork的一部分:曲折的小通道迷宫,都一样。

如果您担心的是虚拟机中的问题,那么尝试获得答案的最佳方法(恕我直言)是使用MAT。特别是在 Android 3.0 及更高版本上,如果您在 SDK 中分配内存,它应该会显示在此处。

要更全面地讨论测量内存使用的非 MAT 方法及其陷阱,我推荐Dianne Hackborn 关于该主题的史诗般的回答

于 2013-06-17T17:22:31.797 回答