0

In my android app, there are ample of image resources, i have implemented them in the way to achieve the maximum performance.

I have freed the memory in almost every screen with System.gc() and calculated heap size in every screen.

The flow of app is when we finish working on the app it restarted from beginning to create new modules. When a user repeat the same process to create modules on 4-5 occurrence the app get force close.

The erroe in the logcat is the same memory budget exceeds VM budget error.

Is there any way to stop the app completely on restarting or handling large bitmaps over multiple occurrences.

I am not aware about the code to close an app completely and in this app i cant proceed finishing all the activities.

There are some limitations. Please help. Thanks.

idiottiger
  • 5,147
  • 2
  • 25
  • 21
  • I have faced the same problem and solved it in this [way ][1]. [1]: http://stackoverflow.com/questions/4611822/java-lang-outofmemoryerror-bitmap-size-exceeds-vm-budget/9177460#9177460 – Rafiq Apr 17 '12 at 10:20

1 Answers1

2

System.gc() in your code the Java VM may or may not decide at runtime to do a garbage collection at that point. Try calling recycle on your bitmaps after you finish your business with them. This will help freeing your memory on time.

  • thanks dimitar, i have used bitmap.recycle() but was showing the same problem. – user1266530 Apr 17 '12 at 10:25
  • i have calculated the heap size in every screen and it is increasing continuously whether we manipulate images or not. – user1266530 Apr 17 '12 at 10:27
  • Recently I have the same problem and recycling helps but may be your problem is different. You say you restart the application how exactly you restart it. May be in the restart you leave some activities in the stack? – Dimitar Dimitrov Apr 17 '12 at 10:31
  • yes there are some activities left in the stack, i have boundation to not close them, since there are being used from multiple points. I am seeking of any code to completely exit the application. – user1266530 Apr 17 '12 at 10:41