Re: GC and security



In article <44F61EEB.8040207@xxxxxxxxxxxxx>,
Les Schaffer <schaffer@xxxxxxxxxxxxx> wrote:

so i am curious. so long as i drop all reference to the passphrase
string(s), eventually it gets garbage collected and the memory recycled.
so "before long" the phrase is gone from memory.

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.
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.

Also keep in mind, of course, that deleting objects has nothing to do
with whether the memory gets overwritten...
--
Aahz (aahz@xxxxxxxxxxxxxxx) <*> http://www.pythoncraft.com/

I support the RKAB
.



Relevant Pages

  • Re: How to free memory in Javascript?
    ... The only memory allocated here is the space allocated for i. ... How do i get rid of the reference to button? ... Whilst in some sense reference counting is a garbage collection pattern ...
    (microsoft.public.scripting.jscript)
  • Re: C vs C++ in Embedded Systems?
    ... >> know, in general, whether a particular reference that it has just been ... And there you are, having re-invented a garbage collection system, ... Just to zip back to the previous discussion about memory space ...
    (comp.arch.embedded)
  • Re: Object suicude
    ... > properly destroy the object, freeing the associated memory. ... Well I was arguing from my understanding of the garbage collection ... The PHP4 garbage collector uses a reference counting algorithm. ...
    (comp.lang.php)
  • Re: which methods to use?
    ... Python's memory allocation has a tendency to ... In the second comparison neither object can be released until the 'is' ... The objects compared using the is operator have at least one reference, ... so they cannot be subject to garbage collection. ...
    (comp.lang.python)
  • [RFC] page replacement requirements
    ... Submitting too much I/O at once can kill latency and even lead to deadlocks when bounce buffers are involved. ... Must be able to deal with multiple memory zones efficiently. ... When on completion of the write to their backing-store the reference bit is still unset a callback is invoked to place them so that they are immediate candidates for reclaim again. ... For traditional page replacement algorithms this is not a big issue since we just implement per zone page replacement; ...
    (Linux-Kernel)