GC中遇到的问题(字节技术)

来源:互联网 发布:大腕精神病预言 知乎 编辑:程序博客网 时间:2024/05/21 18:40

问题 (Question)

I have been getting this error since last three days, I did a lot of search but I dint find any useful answer, (some people say that it is bcoz of null referencing but I am no where referencing null) I am getting this error when I am trying to write the inputstream of an image file into the byte array, any help will be appreciated

Logcat show like this:

GC_FOR_ALLOC freed 5178K, 21% free 45743K/57384K, paused 49ms, total 50msGrow heap (frag case) to 68.666MB for 22220109-byte allocationGC_CONCURRENT freed 41K, 15% free 67405K/79084K, paused 3ms+11ms, total 60msFatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 21864 (GC)

我一直以来的三天,最后得到这个错误,我做了很多搜索但我力找到有用的答案,(有人说它是空引用,但我没有引用无效)我得到这个错误的时候,我想写的图像文件的输入流到字节阵列,任何帮助将不胜感激

LogCat这样的节目:

GC_FOR_ALLOC freed 5178K, 21% free 45743K/57384K, paused 49ms, total 50msGrow heap (frag case) to 68.666MB for 22220109-byte allocationGC_CONCURRENT freed 41K, 15% free 67405K/79084K, paused 3ms+11ms, total 60msFatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 21864 (GC)

最佳答案 (Best Answer)

GC_FOR_ALLOC means there were not enough free memory to fulfill an allocation request, so a garbage collection was necessary, whereas GC_CONCURRENT just means that the GC felt like running, typically because the amount of free memory became lower than a certain threshold after an allocation.

You can try to analyze memory for your Android application:
http://developer.android.com/tools/help/traceview.html
http://android-developers.blogspot.se/2011/03/memory-analysis-for-android.html

Check your app for memleaks

GC_FOR_ALLOC意味着没有足够的可用内存来满足分配请求,所以垃圾收集是必要的,而GC_CONCURRENT只是意味着GC感觉运行,通常是因为在分配可用内存低于某一阈值的了。

你可以试着分析你的Android应用程序的内存:
http://developer.android.com/tools/help/traceview.html
http://android-developers.blogspot.se/2011/03/memory-analysis-for-android.html

检查你的应用程序memleaks

0 0
原创粉丝点击