Hacker News new | ask | show | jobs
by k__ 3107 days ago
"When finishing a level, the game would reboot the console and restart itself with a command-line argument(the name of the level to start) ... into the next level. Voila, the perfect(?) way to clear all memory between levels."

Well, that's basically how most websites work, lol

2 comments

Serverless architecture right there. That or PHP and similar tools - at least back in the good ol' days. But functionally, it's still that a PHP scrip runs a whole application for the duration of one request, then everything is wiped and the whole thing is restarted for every request.

I mean it can work and it's a viable tactic if startup time is fast enough.

As long as the process is acceptably fast, nuking & restarting (with an appropriate amount of isolation) is a fine approach to many things that would be harder or less efficient if done the “right” way. Memory pools and “let it fail” architecture in Erlang come to mind; and there’s a practice sometimes seen in Forth, where you ensure that the codebase itself is always small enough that it can always be easily rewritten, for example if requirements change enough that incremental development would be harder.
I do it like that on mobile too.

New screen? Okay, lets throw everything away.

As long as performance is okay, I don't keep stuff around in memory.