0

I have created a new android Emulator based on Android 2.3.3 with 512MB RAM and 32/64/128/256/512 Heap Space.

But i still get the same problem all the time i try to install a package with adb install:

D/dalvikvm(  341): GC_CONCURRENT freed 429K, 41% free 3445K/5767K,
external 716K/1038K, paused 5ms+2ms

i get this twice per second and the emulator fed up all the system resources (CPU and RAM). So is there a bug somewhere in the heap allocation? Or do i need to set the value to something extraordinary high like 65535? This Logoutput does only seems to start when i try to install a package.

Edit: i will specify it a little bit more clearer: it doesnt matter what value i enter in the config.ini file for the vm.heapSize, in any case i get the same memory value of 5767K from the GC Message above. So this is truly a bug of the emulator! And again i didnt programmed anything, i just need my emulator up and running!

reox
  • 5,036
  • 11
  • 53
  • 98
  • Your heap is full look at this answer: http://stackoverflow.com/a/6592129/1322642 – moskito-x Aug 28 '12 at 10:12
  • @moskito-x probably :) the problem is i try to install apps i downloaded from play before and pulled from my phone... so i cant just remove the leak in the code... the only option is to give the emulator as much heap as it takes to install a very normal app. – reox Aug 28 '12 at 12:56

2 Answers2

0

Its not a bug you are getting. The android is collecting garbage data as per the requirements. Please see this link for greater detail of the same.

Thank you.

Shrikant Ballal
  • 7,067
  • 7
  • 41
  • 61
  • cool, but no answer to my question in this blog... the emulator is very useless when it tries to endless cleanup its memory and pushing the load in endless ranges... so is there any possibility to set up the limit of maximum objects on the heap? – reox Aug 28 '12 at 08:51
  • 1
    Why you are worrying about the GC? As long as I have experienced, It does not create any problem, its just clearing data to make space for running the application at appropriate places. Are you facing OOME? – Shrikant Ballal Aug 28 '12 at 09:55
  • nope, it does not give me any error message. it just seems like the emulator hung up on too much GC events... – reox Aug 28 '12 at 10:04
  • Yeah..I have also experienced that.. Hey just found one link, may be useful for you: http://stackoverflow.com/questions/11695029/excessive-garbage-collection-gc-for-malloc-in-android-emulator-when-using-simp – Shrikant Ballal Aug 28 '12 at 10:15
  • Nope, still the same problem with the emulator... and i cant change the code because i need to test specific apps in there. so its a problem with the emulator not with memory leaking code – reox Aug 29 '12 at 08:41
0

I think you are understanding things a little wrong -- the 5767K amount is the current size of the heap, not the maximum size of the heap which what you are changing.

The Android GC is very aggressive -- that is when a new object is created the GC will generally always prefer to clean up old objects to free space than to increase the heap size, which is the behaviour you are seeing here. No matter what size you set the maximum heap to you will not reach it doing what you are doing because in this case the GC is always able to free old memory instead, and so this is what it will do.

Try writing a program that keeps allocating Bitmaps (and make sure you a keep a reference to all the Bitmaps you create so the GC cannot collect them) and see how large your heap gets then.

The GC on devices may be a little less aggressive but will probably be similarly tuned.

Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
  • okay i understand. but the GC keeps like freezing my emulator, is there nothing i can do? – reox Sep 03 '12 at 13:26