[Stackless] Stackless status

Christian Tismer tismer at appliedbiometrics.com
Sun Oct 8 17:52:47 CEST 2000


Thanks a lot, Just!,

Just van Rossum wrote:
> 
> At 4:53 PM +0300 08-10-2000, Christian Tismer wrote:
> >What memory-leak problem are you referring to? Stackless
> >Python itself has no leak, when just used to replace
> >the Standard distribution. It is said that the continuation
> >module shows a leak under special circumstances with
> >exception handlers, but I couldn't reproduce them yet.
> >
> >If anybody can produce such a leak under Win32, please
> >let me know and send me the code.
> 
> Dunno about Win32, but the following script leaks on my machine (most of
> the time, but not always!):
> 
> import continuation
> 
> class LeakMonitor:
>         instances = 0
>         def __init__(self):
>                 LeakMonitor.instances = LeakMonitor.instances + 1
>         def __del__(self):
>                 LeakMonitor.instances = LeakMonitor.instances - 1
> 
> def leaker():
>         continuation.return_current()
>         lm = LeakMonitor()
>         for i in range(10000):

Soooo sorry (really, I'd like to find that!), but even after
raising this to a million, it doesn't show a leak, with PythonWin,
command line Python, and Idle.

When I start an interactive cmdline task and run the script
(modified to iterate 1000000 times, using xrange), taskmanager
tells me that its size is 1.736 kb. On the second run, this
becomes 1.740 kb. Next time it is 1744 kb, and all the next runs
stay with this measure.

Help, can somebody produce this error? - ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com
-------------- next part --------------
import continuation

class LeakMonitor:
        instances = 0
        def __init__(self):
                LeakMonitor.instances = LeakMonitor.instances + 1
        def __del__(self):
                LeakMonitor.instances = LeakMonitor.instances - 1


def leaker():
        continuation.return_current()
        lm = LeakMonitor()
        for i in xrange(1000000):
                try:
                        1/0
                except:
                        pass
        continuation.uthread_reset()
        print "done!"


co = leaker()

# minimal uthread scheduler
while co:
        co = continuation.timeslice(co)

print "Number of instances left (should be zero):", LeakMonitor.instances,\
      continuation.framecount()


More information about the Stackless mailing list