Open slankka opened 8 years ago
Your program is interesting.But on my device, when I click share button, the program FC. In the console, I got these:
moe.chionlab.wechatmomentstat E/AndroidRuntime: FATAL EXCEPTION: main Process: moe.chionlab.wechatmomentstat, PID: 12892 java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) ... at moe.chionlab.wechatmomentstat.gui.MomentStatActivity. generateShareImage(MomentStatActivity.java:207)
and you should release memory after you use Bitmap. Here are my advices:
android:largeHeap="true"
finally { if(cs!=null){ cs.setBitmap(null); cs=null; } if(dest!=null){ dest.recycle(); dest = null; } if(src!=null){ src.recycle(); src = null; } }
The memory allocated for bitmap will be free after about 20s.
Thanks for your advices. It would be great if you could create a pull request for us to solve this problem. Yeah I should have noticed the memory allocation problem.
Your program is interesting.But on my device, when I click share button, the program FC. In the console, I got these:
and you should release memory after you use Bitmap. Here are my advices:
android:largeHeap="true"
The memory allocated for bitmap will be free after about 20s.