del()?
Paul Prescod
paulp at ActiveState.com
Wed Apr 4 20:53:05 EDT 2001
Jay Collins wrote:
>
> does del() free the ram used by string?
>
> like
>
> a = "my string"
> del(a)
>
> will I get my ram back?
Yes.
> Should I even worry about this since gc takes care
> of this?
Not really. You could just as easily get your ram back by typing
a = None
Or you could just let "a" go out of scope when the function ends or the
module goes away.
When there are no more references to a thing it goes away. Your "del" is
probably less efficient than simply letting the thing go out of scope.
--
Take a recipe. Leave a recipe.
Python Cookbook! http://www.ActiveState.com/pythoncookbook
More information about the Python-list
mailing list