[Stackless] Memory footprint for tasklets and channels

Bob Ippolito bob at redivi.com
Fri Mar 17 22:19:02 CET 2006

On Mar 17, 2006, at 1:05 PM, Johan Carlsson wrote:

> Bob Ippolito wrote:
>> On Mar 16, 2006, at 10:48 PM, Johan Carlsson wrote:
>>> Bob Ippolito wrote:
>>> Thanks Bob :-)
>>>>> Anyway, to the question:
>>>>> How much memory footprint does the different parts of Stackless  
>>>>> take.
>>>>> E.g. a Tasklet, a Channel, the Scheduler and any queues etc...
>>>> Not much more than any other object in Python.
>>> Any idea how much that is or even better how to measure that?
>> Does really matter?  It's pretty small, a couple bytes.  Read the  
>> headers...
> Well if you intend to have millions of them :-)

Sure, but it's not much different than having millions of anything  
else in Python.  PyObject has a certain overhead, and a tasklet  
doesn't have a whole lot of state to it other than the frame(s)  
associated with it.  If you're interested in what a few million  
tasklets would be like, then instantiate a few million generators...  
it should be comparable.

>>>>> Is there a limit for how many of this thing you can create  
>>>>> other than
>>>>> memory? I'm assuming a halted tasklet doesn't consume any  
>>>>> processor
>>>>> power at all.
>>>> There isn't any limit, and tasklets certainly don't consume  
>>>> anything  but RAM when they're not running (how could they?).
>>> Any idea how much processing overhead does the channels add?
>> Channels hardly do anything at all.  Either way, you'd need  
>> something to compare it to in order to say what the "overhead" is.
> Ok, what would happens if I put 100.000 tastlets waiting for a  
> channel each, for instance? (Not 100.00 tasklets waiting for one  
> channel, which I guess would be a piece of cake :-)

Nothing happens.  Channels don't do anything at all except when you  
send or receive through them.  You can have two or two million  
channels, the only difference is the amount of memory you're using.   
Technically having lots of tasklets waiting on one channel is  
actually a little harder to do than having lots of channels with very  
few tasklets each because the channel has to maintain a big list of  
tasklets in the former case.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list