N/A wrote: > Hi all, > I am learning Python. Just wondering how to clear saved memory in > Python? Like in Matlab I can simply use "clear all" to clear all saved > memory.
You don't - python does it for you. It is called garbage collection. All you have to to is get into granny-mode(tm): forget about things. That means: once an object is not referenced by your code anymore, it will be cleaned up. For example: >>> l = range(100000) >>> del l will make python garbage collect the list referred to by l. Actually, this will work too: >>> l = range(100000) >>> l = None Because l now refers another object (None in this case), the _list_ that was refered beforehand gets freed as it's reference counter is reduced by one. Generally speaking: don't worry. HTH, Diez -- http://mail.python.org/mailman/listinfo/python-list