|This part of the program is run whenever anyone inside the elevator presses the button for a floor.|
The memory leak would occur if the floor number requested is the same floor that the lift is on; the condition for releasing the memory would be skipped. Each time this case occurs, more memory is leaked.
I find this interesting because if we were to compare the computer's random access memory to our human brain, it would still believe that the concentration is required for the task it was given, even if the person who gave the task is no longer present, using up unnecessary ability.
A neat (and free I might add) program called PowerStrip fixes this (among other things), providing you have a bit of a look through it's settings once you install it. The setting in question "automatically recover memory" checks all requests to your system memory by programs, and makes sure all requests are currently in use, if memory isn't being used (requested by a program that is no longer running or even uninstalled) it will cancel the request and reallocate that to the available system memory. It performs this indefinitely while you have PowerStrip running.
While I'm being a salesperson for this software, I may as well also mention that you can use it to modify the screen brightness and gamma beyond factory settings (darker or brighter than your keyboard shortcut keys allow). Ever using your laptop in the dark and wish the sheer light it's emitting wasn't so blinding? You can drop it right down to the point where it's like you're reading a book in very pale light.
Anyway. 'nuff said. If you're on your computer all the time download this. The only thing you'll regret is the popup you have to watch for 20 seconds (but other windows can go over the top of it) unless you want to pay the developers money.