Java – Why don’t mobile platforms support generational garbage collection

androidgarbage-collectionjavanetwindows-phone-7

Both Windows Phone/Xbox and Android lack support for generational garbage collection. This is frustrating for a lot of programmers. There seems to be a legitimate engineering reason to it, but I can't figure it out.

Current phones have more memory and probably better CPUs than the desktops/laptops running .NET 1.1 with generational GC back in 2001, and I can't think of any reasons that ARM processors would be worse at generational GC than x86 would. There's also less need for multitasking on phones and consoles, so there's relatively more free heap space.

So what gives?

Edit: A few points to clarify:

  • These platforms use garbage collection for apps exclusively, so my question isn't about why GC isn't supported; my question is about why generational garbage collection isn't.
  • The reason that people are frustrated about the lack of generational GC is that non-genrational GC is extremely inefficient. (That means that battery life isn't the reason.)
  • I do believe that there's an honest technical reason for the lack of generational GC support. This isn't a rhetorical question.

Best Answer

I think the biggest problem is the battery life. Garbage collection is a developer convenience bought at the price of additional CPU cycles on user's computer. When your CPU is plugged in (desktop) or has a relatively large battery (laptop), your users are more willing to pay for developers' convenience with the additional energy consumed by CPU while doing garbage collection. When the battery is relatively small, the users may not be as generous. They may want that additional bar for themselves - perhaps to talk to their friends, or to kill a few extra pigs in a deadly encounter with angry birds.

No matter what users' reasons are, OS developers do not want to form a perception that the devices running their OS drain battery faster than ones running their competitor's OS. So they buy better perception of their devices' expected battery life time at the price of developers' convenience: to them, your pain is no big deal, as long as the users are happy with the devices.