View Single Post
Old Mar 19th, 2007, 8:41 AM   #11
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Whilst Python discards memory instantly, your OS usually does not. If a chunk of memory is freed by a program, and you have plenty of free RAM around, then the OS will often keep the chunk of memory around until it's needed.
True, but so is the converse. If you, or another application, need more memory than is available, the OS will swap a page of memory to disk until that memory is required again. The memory swapped out will be chosen using an algorithm such as "least recently used" or "least frequently used". While the approach isn't perfect (thrashing can occur under certain conditions), it is likely to be more effective than off-the-cuff steps.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote