[Stackless] Tasklet Slot Inheritance

Christian Tismer tismer at stackless.com
Sun May 20 20:42:40 CEST 2007


On 20.05.2007, at 19:16, Kristján Valur Jónsson wrote:

>
>> -----Original Message-----
>> From: stackless-bounces at stackless.com [mailto:stackless-
>> bounces at stackless.com] On Behalf Of Richard Tew
>> When a tasklet is killed, it has its references cleared through the
>> tp_clear method.  This is part of the Python type implementation and
>> clears various references in order to prevent or break reference
>> cycles.  Including, as observed here, the slots.
>
> tp_clear() is supposed to be called by the garbage collector when  
> it so chooses.  It is not usually something that should be manually  
> invoked.  I am curious as to why this was added.   There must have  
> been a good reason, since this is highly unorthodox.  Maybe  
> Christian can recall?

I wanted to have a way to really break a tasklet. I think the main  
reason
was the existance of those stack slices in hard-switching.
The problem is that these stack slices create references to objects
which cannot be garbage collected. Therefore, I needed to explicitly
peel everything out of the tasklet myself to loose as many as possible
references, ASAP.

IOW., I need to call tp_clear here, because the GC fails to do it,
because references coming from stack slices are not detected and GC
never gets called.

Maybe it is possible to do a less crude cleanup, preserving user  
attributes,
if you think it is worth the effort.

cheers - chris



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



More information about the Stackless mailing list