2

I heard that there is no memory limitation PER APPLICATION for JNI in Android. Then how can I find the limitation for memory in JNI in Android? I assume it would be relative much larger, of course, still depending on how many applications are running, how much memory has been used in JNI.

I will do some image processing in JNI, and I do not like outofmemory exception. How can I avoid it?

4

1 回答 1

1

我认为您不需要知道 JNI 中的内存限制。尝试分配您需要的内存,如果返回 null 表示没有可用内存。如果你想做图像处理,你必须先解码图像。限制您的位图大小(宽度,高度),否则您将耗尽内存。您最好缓存图像数据以供重复使用。不要在内存中保留大量位图。回收无用的位图以增加可用内存。小心控制你的内存,你不会遇到内存不足的异常。

于 2013-08-29T09:54:55.073 回答