Test: How changing the max amount of memory per VM Heap can effect your ROM (Cyanogen)

The latest release of Cyanogen’s CM6 features a new feature in Settings called ‘Cyanogen Settings.’  In one of my other posts, ‘Cyanogen CM6 for the nexus one (Review)‘, i briefly covered these new settings that cyanogen has added.  In this post i decided to explore deeper into ‘Cyanogen Settings.’

What are the ‘Cyanogen Settings’?

Cyanogen settings are setting that cyanogen put into settings that allow you to tweak how certain things are shown, how applications are installed, tweak Dalvik VM settings that could speed up your phone and input settings.

Here is a brief summary of each setting from within Cyanogen Settings:

  • Application settings :    allows you to modify your rom to allow application moving and to set the default install location
  • Input settings :    allows you to tweak haptic feedback, change what happens when you long-press home, enable trackball wake/unlock, enable menu unlock and to have the trackball always pulse while the screen is on
  • Performance settings :   allows you to enable JIT (just-in-time compiling), enable surface dithering (which improves image quality) and to change the VM heap size (32 m, 24m, 16m, 12m)
  • User Interface :     allows you to change the color of various different framework variables (such as the clock, notifications, notification bar) –previously in spare parts.

How can changing my VM Heap size speed up my ROM?

I’m not going to go into the physical effects of changing the VM Heap size in cyanogen settings (Note: this is for advanced users only.. i take no responsibility for anything that can potentially happen to your advice.

Cyanogen’s Warning

“Warning dragons ahead! The options in here will change the performance of your system, potentially for the worse. They are included for experimentation and we that you do not file bug reports if you have changed any from the defaults”

But i have decided to experiment and run some tests on how changing the maximum memory size per VM Heap can speed up your phone–or slow it down.

All of the tests i have performed have been in the most controlled environment for consistent tests (fresh reboot, airplane mode on, no programs running, Cyanogen default kernel overclocked to 1113 MHz).  Here are the results of my linpack benchmarks for each memory size using Linkpack for Android:

From the results of my tests, you can see that 12m reigns superior and 32m is pretty close to matching it.  32m is the default that cyanogen ships with his roms, but maybe 12m should be? These tests are just my results when i experimented with them, If you have tested on your phone, you should comment on this with your results and we can see what is the best for our Android devices (make sure to include your device)

A quick tutorial: How to change the max amount of memory per VM Heap using Cyanogen Settings


  1. Install cyanogenmod (CM6) on your android device — only certain devices have CM6 out for them — go to cyanogenmod.com for the download and if needed, to check if your device has Cyanogenmod made for it
  2. From your homescreen, hit menu->settings->cyanogen settings
  3. From Cyanogen settings, click on performance settings
  4. Click VM Heap size to then select the max amount of memory you’d like per VM Heap
  5. Reboot
  6. Done! once your device is booted up, the Dalvik VM will now be running how you specified

UPDATE: These were just the results that i got while using Linpack for Android.  After speaking with Cyanogen, I found out that using 12M IS really fast with small applications BUT with bigger applications this can cause crashes everywhere.  The lower max amount of memory options are there because they work well with smaller devices (G1/MyTouch)

    • 7h3.4pp12en7ic3
    • July 14th, 2010

    I’m rather curious how decreasing the VM heap size sped your system up at the 12mb setting. How many trials did you run per heap size? I’m currently running a Motorola Droid, OC’d to 1150mhz with JDLFG’s Low Voltage Kernel, with 32mb Heap Size. The default for the Droid is 24mb, and my experience from numerous tests and an unofficial average, I was scoring about 16.5MFLOPs with linpack on the 24mb heap, and 17.6-17.8 MFLOPS with a 32mb heap. I have not yet tested the lower heap sizes, as from my knowledge of the mechanics of the VM Heap, a larger heap SHOULD give a faster system.

      • ryanolson
      • July 14th, 2010

      i ran probably around 100 tests for each VM Heap size.. by the sounds of it, for HDPI devices (like the droid) would probably run best on the 32mb setting (and continue to have a stable device) but yeah, you can test out the lower sizes.. would love to see how your tests turn out

      • Jay
      • December 19th, 2010

      I have a Moto Droid 2 using the stock Rom overclocked to 1350 MHZ. I set the VM heap size to 12 and rebooted and my phone kept rebooting. I had to do a Hard Reset because my droid 2 would not even unlock. The stock heap for it is 30.

    • Jason DiCioccio
    • July 14th, 2010

    While you got better performance with linpack, this will likely not be the case with everything. For an application with low memory requirements, but with some object churn, lower max heap sizes should be better since GC cycles will take less time to complete. For an application with high memory requirements, the 12m might not be enough memory to even run the application. If it’s like Sun’s VM, what will likely happen is that the program will launch and run up until it approaches 12m worth of referenced objects. At that point, it will enter an endless garbage collection cycle and will likely be killed or freeze. For an app like this, the 32m limit is vastly superior.

    I suspect the linpack benchmark does not keep anywhere near 12m worth of referenced objects at any given time.

    I haven’t tested any of the above with the dalvik VM, so it’s largely theoretical. I’d be interested to see it tested though.

    • Jason DiCioccio
    • July 14th, 2010

    Looking at the graph though, what’s interesting is the difference between 12m and 24m vs 32m. It’s a very odd curve. I wonder if anything else is changed with the 12m setting? Like the type of garbage collector that the VM chooses to use?

  1. My concern would be that linpack is a fairly artificial benchmark – if we’re talking about a default setting then I’d be greatly concerned how changing the setting impacted the overall user experience.

    A big issue on Dream is lack of memory and CPU overall, so ability to switch apps and not lose state or have long delays might be a big factor, even if any particular app runs a little slower.

    This is the danger with benchmarks – if what you test doesn’t match what you actually use the phone for, then you could optimize the phone to NOT act ideally when you actually want to use it for anything other than benchmarking.

    • sbdy
    • November 15th, 2010

    Maybe a nicer comparison would be something like:

    On a clear system, how many browser tabs can there be opened in parallel (open engadgement.com (the full experience) or something) before the browser crashes. I got some around 3 mobile-optimized and 2 not optimized sites with a 12MB heap. So for my daily use that is perfectly enough. Additionally I had around 5-6MB more RAM available.

    • crst
    • December 15th, 2010

    You will get force closes with at least a few apps if you set the max heap size to 12 MB. Android Dev documentation states 16 MB to be standard, so developers are trying to put their stuff in 16MB of memory, not 12 MB.

    • Mattia
    • March 28th, 2011

    With my Desire Z if i use 12m everyting crash!

  2. I have a droid one and was running CyanogenMod 7.1.0-RC1. I updated my VM Heap size to be 12m (from the 24m default) based on this article. When I rebooted the phone it would continuously loop at the bootup animation. I had to restore a backup to get the phone working again. Now I am going to try 32m to see if I have better luck.

    • i had the same problem, i changed vm heap size to be 12m, and cannot booting. how did you restore your phone into normal?

      my hh tipo

    • Carl
    • November 18th, 2012

    If you set your heap to 12MB, good luck, because many apps are written to expect at least 16MB on the device. 16MB is what the ancient G1 shipped with, and it’s kind of a standard. Developers will write apps right up to that limit with absolutely no sense of guilt. That’s undoubtedly why CM6 shipped with 32MB as the default for the N1.

  3. I usually do not leave a ton of comments, however i did a few searching and wound up here Test:
    How changing the max amount of memory per VM Heap can effect your ROM
    (Cyanogen) | Ryan Olson. And I do have 2 questions for you if it’s allright. Is it just me or does it look like a few of the remarks appear as if they are left by brain dead people? 😛 And, if you are posting at other places, I’d
    like to keep up with anything new you have to post.
    Would you list of all of all your community pages like your twitter feed,
    Facebook page or linkedin profile?

      • ryanolson
      • April 22nd, 2013

      Hey, sorry.. I don’t really blog too much anymore. I might start again sometime but in the meantime, you can follow me on twitter @ryanolsonx.

  4. I do not know if it’s just me or if perhaps everyone else encountering problems with your blog. It looks like some of the written text in your posts are running off the screen. Can someone else please comment and let me know if this is happening to them as well? This may be a issue with my web browser because I’ve had this happen
    before. Thanks

  5. An outstanding share! I’ve just forwarded this onto a friend who was conducting
    a little homework on this. And he in fact ordered me dinner due
    to the fact that I stumbled upon it for him… lol. So let
    me reword this…. Thanks for the meal!! But yeah, thanks for spending
    some time to talk about this matter here on your web site.

      • ryanolson
      • May 20th, 2014

      Hey thanks! I remember when I posted this a long time ago, I was mainly curious about what each would do. I never thought it would help anyone 🙂 I’m glad that it did!

  6. I blog frequently and I truly thank you for your information.
    This article has truly peaked my interest. I will
    bookmark your site and keep checking for new details about once a week.

    I opted in for your Feed as well.

  7. I’m not sure exactly why but this web site is loading incredibly
    slow for me. Is anyone else having this issue or is it a problem on my end?
    I’ll check back later and see if the problem still exists.

  8. hello!,I like your writing very a lot! proportion we communicate extra about your article on AOL?
    I need a specialist in this house to unravel my problem.
    Maybe that’s you! Having a look forward to see you.

  9. Wonderful post however , I was wanting to know if you
    could write a litte more on this topic? I’d be very grateful if you could elaborate a little bit more.
    Many thanks!

  10. I am sure this article has touched all the intternet visitors,
    its really really ice piece of writing on building uup new web site.

  11. Asking questions are in fact nice thing if you are not understanding anything
    totally, except this article offers pleasant understanding yet.

  12. Hi there I am so thrilld I found youur site, I really
    found you by mistake, while I wwas browsing onn Digg for somethinmg else, Anyhow I am here now and would just like
    to sayy many thanks for a fantastic post and a all round exciting blog (I also love the theme/design), I don’t have
    time to read iit all at the minute but I habe book-marked it and also included your RSS feeds, so
    when I have time I will be back to read a lot more, Please do keep up the superb work.

    • fun restaurants in atlanta
    • August 21st, 2018

    I don’t know whether it’s just me or if everyone else encountering issues with your website.
    It appears as if some of the text within your content are running off the screen. Can somebody
    else please provide feedback and let me know if this is
    happening to them too? This may be a issue with my
    web browser because I’ve had this happen previously. Appreciate it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: