-2

In My application( PhotoCrop) i am getting force close after 4 or 5 images was used at a time. in the TaskManager it shows RAM :30 Mb and CPU:(varies 10 to 20%). it show's three different colors (Red, yellow, blue).

I am not getting Where is the problem, the error is ( Vm budget exceed's ) i am using some Bitmap's in the programming i have added this line to bitmap's after usage over.

bitmap.recycle(); 

still i am not able to solve this problem.

please tell me how can i resolve this problem.

Utku Zihnioglu
  • 4,714
  • 3
  • 38
  • 50
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166

1 Answers1

1

You might be doing something like this:

Bitmap b = BitmapFactory.decodeFile("test");
//doing something with the bitmap
b = BitmapFactory.decodeFile("test2");
//and so on
b.recycle();

That sample will keep the reference to the first bitmap and will not be garbage collected. The second one will. So you have to remember to b.recycle(); before you load a new bitmap.

Cheesebaron
  • 24,131
  • 15
  • 66
  • 118