Python 2 multiprocessing examples in

Xavier Ho contact at
Fri Feb 1 05:14:49 CET 2013

Hey all,

I ran the example code on multiprocessing.  On the "Pool example", an
assertion failed with "testing garbage collection".

Traceback (most recent call last):
  File "", line 314, in <module>
  File "", line 295, in test
    assert not worker.is_alive()

The relevant example code reads:

    pool = multiprocessing.Pool(2)
    DELTA = 0.1
    processes = pool._pool
    ignore = pool.apply(pow3, [2])
    results = [pool.apply_async(time.sleep, [DELTA]) for i in range(100)]

    results = pool = None

    time.sleep(DELTA * 2)

    for worker in processes:
        assert not worker.is_alive()

My questions are 1) How does that GC test work, and 2) Does that mean my GC
isn't working as fast as it should have been?

The machine's Python:

xav ❖ /tmp  > python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list