del()?
Aahz Maruch
aahz at panix.com
Thu Apr 5 11:35:47 EDT 2001
In article <Pine.LNX.4.21.0104042019020.17701-100000 at tarpon.exis.net>,
Jay Collins <jcollin at exis.net> wrote:
>
>does del() free the ram used by string?
>
>like
>
>a = "my string"
>del(a)
>
>will I get my ram back? Should I even worry about this since gc takes care
>of this?
I am not entirely sure the answers you've been given are correct.
They're probably true for the specific case you're using, but certain
strings get interned (e.g. "a = 'my'", 'my' is interned), and while the
reference will go away (that is, the variable a will be freed), I'm not
entirely sure the string itself will be freed.
This subtlety (if true) is probably irrelevent for your needs; I just
wanted to get the technical accuracy. (Someone more familiar with
Python's internals will have to verify whether I'm right.)
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"The only problem with Microsoft is they just have no taste." --Steve Jobs
More information about the Python-list
mailing list