[pypy-dev] Memory management

Christian Tismer tismer at tismer.com
Sat Feb 15 19:42:28 CET 2003


holger krekel wrote:
> [Christian Tismer Sat, Feb 15, 2003 at 06:19:57AM +0100]
...

>>One of PyPy's intentions is to get stuff like that
>>onto another level of abstraction. A function with
>>a parameter should not need to spell an extra reference
>>to the parameter, but it should tell the RTL that it need
>>this parameter to stay alive while it needs it.
>>This might have the same implementation, but is very
>>different from an algorithmic view.
> 
> 
> Hmm, this i don't understand.  It sounds much like current
> INCREF/DECREF which means exactly this: "i want to use
> this object"/"i don't want to use it anymore".  Objects
> can be shared in many places so i don't yet see how your
> "tell the runtime that it needs this paramater to stay
> alive while it needs it" beeing different from 
> current CPython's scheme.  Can you give a more concrete
> example how this would work and/or be spelled?  Or
> anyone else? 

Simple. You don't want to INC/DECREF, but you want
to spell how the lines of your code increase or
decrease the liveness of objects.
"I need it to be alive from here to here", maybe.
Obe approach would be to mimick the automatic
variables of C++. An implementation *could*
be that the initialiser of an automated local variable
increases the refcount of the object that is attached,
and that it decrefs again, when the scope of the
function is left. This is *one* implementation.
Whatever we implement, if it is possible to
switch from refcounts to a gc without changing
our implementation, then we have made a huge improvement.

I was about to explain this further, but now I see
Armin's post, it says exactly what I wanted to say.

See 'ya tomorrow -- chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/




More information about the Pypy-dev mailing list