I am trapped with the OOM issue when I need to create large bitmap like 1920*1200 or even bigger. The program often crashes saying that DVM won't let me to allocate a bitmap of 9MB.
However, if I attach the program with DDMS and force GC before I create the bitmap, it works fine.
So I tried to call System.gc() in the decoding thread and even force the thread to sleep 1s for waiting the gc to happen. However, it never happens as I wished. Gc is still working in its own way.
So, could anybody tell me how to force GC to happen or is there any better way to deal with this case?
Update: I can see that I could just use DDMS to attach to the process and the GC will happen in real time. And it is working very well, no OOM ever. How can I achieve this effect?