durusmail: quixote-users: SCGI vs. mod_python
RFC: SCGI graceful restart
2003-02-20
SCGI vs. mod_python (was RFC: SCGI graceful restart)
2003-02-20
SCGI vs. mod_python (was RFC: SCGI graceful restart)
SCGI vs. mod_python (was RFC: SCGI graceful restart)
2003-02-20
2003-02-20
SCGI vs. mod_python
2003-02-21
2003-02-21
2003-02-21
2003-02-21
2003-02-21
2003-03-01
2003-02-21
2003-02-21
2003-02-21
2003-02-21
2003-02-21
2003-02-21
Re: RFC: SCGI graceful restart
2003-02-20
SCGI vs. mod_python
Neil Schemenauer
2003-02-21
On Fri, Feb 21, 2003 at 09:39:18AM -0700, Jonathan Corbet wrote:
> [Finding memory leaks]

The attached code might help.  Call it periodically to see what new
"container" objects are getting created.

  Neil


old_count = {}

def count_types():
    import gc, types
    gc.collect()
    new_count = {}
    for o in gc.get_objects():
        t = type(o)
        if t is types.InstanceType:
            k = 'class ' + o.__class__.__name__
        else:
            k = t.__name__
        new_count[k] = new_count.get(k, 0) + 1
    if old_count:
        for k, n in new_count.items():
            old_n = old_count.get(k, 0)
            if n != old_n:
                print k, old_n, '->', n
    old_count.clear()
    old_count.update(new_count)

reply