Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That is why I said it's usually not needed, "especially these days". This was not true at the time. Relying on primitive compilers, especially the likes of the J2ME garbage collection would lead to total freezes in a game from something as simple as a loop. As the garbage collector decides previous passes in the loop are no longer needed it can trigger a garbage collection sweep. With such a slow and limited device a garbage collection sweep would literally cause a game to freeze until the sweep completed which could take on the order of several seconds.

The loop unrolling was just one example of how we would go about preventing an undesirable sweep.

As another example a large global game object array would be created when a game was started. As objects were created and deleted they would really just update pre-created objects in that array.

This allowed us to prevent garbage collection, while simultaneously making sure we didn't run out of memory.

The Nokia 1618 (a series 40 device) has a heap limit of 1024KB. Many S20 and S30 devices were even further memory constrained.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: