[Stackless] Weakref support for tasklets

Christian Tismer tismer at stackless.com
Thu Jan 29 20:05:53 CET 2004


Bob Ippolito wrote:

> I'm committing weakref support for tasklets, because I have a need for 
> it (giving each tasklet a separate stdin/stdout/stderr by using proxy 
> objects with __getattr__, since I can not give them separate sys 
> modules).  I'm not 100% of the ramifications of this, but it was about a 
> four line change and it doesn't seem to cause any problems (though it 
> does show how tasklets can be a little odd).

Ok, looking into lines 1220 to 1240 of typeobject.c (py2.2.3 still)
shows that a weak pointer costs exactly one word, like
the existence of a __dict__ does.
Not too bad, although, well it has to have a benefit.
I have been very tightfisted with tasklet memory, since
I want to have millions of them.
But I think your application makes sense.

> Additionally, would it be useful to put a weakref slot on channels?  I 
> don't need that at the moment, but it might be useful to someone?

No problem with channels, since I expect them to exist
10 times fewer than tasklets.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.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  mobile +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/

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list