> 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? del will free the memory location immediately (so long as nothing else has a reference to it). If you don't del it, you will have to wait for all references to disappear - in the case of module namespace, this will only occur when your program ends, or possibly if someone reloads your module explicitly. So yes, if you no longer need it, and especially if it is in the module namespace (or any long-running namespace such as a long-running function), you should definitely del it. You could also set a = None - this would also remove the reference to "my string", although it would leave the name "a" hanging around. del actually gets rid of the name (try accessing a after each - after del it will give you a NameError). Note: the parentheses you have in del(a) are superfluous - del is a keyword and should be called as del a Tim Delaney All recipient(s) of this email have permission to forward or reply to this email, quoting this email in full or in part.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4