GC and security

Les Schaffer schaffer at optonline.net
Wed Aug 30 23:18:15 EDT 2006


Aahz wrote:

> Assuming you're talking about CPython, strings don't really participate
> in garbage collection.  Keep in mind that the primary mechanism for
> reaping memory is reference counting, and generally as soon as the
> refcount for an object goes to zero, it gets deleted from memory.

ok so far ...

> Garbage collection only gets used for objects that refer to other
> objects, so it would only apply if string refcounts are being held by
> GC-able objects.

you lost me by here ... is there something different about string
objects than other objects in Python? are you saying EVERY string in
Python stays in memory for the lifetime of the app?


> Also keep in mind, of course, that deleting objects has nothing to do
> with whether the memory gets overwritten...

no chance of being overwritten until deleted, no?  and once deleted over
time there is some probability of being overwritten, no? and i am
curious how that works. it sounds like you are saying once a string,
always the same string, in python. if thats true, i am glad i know that.

Les Schaffer



More information about the Python-list mailing list