Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72125

help with memory leak

From Neal Becker <ndbecker2@gmail.com>
Subject help with memory leak
Date 2014-05-27 15:56 -0400
Newsgroups comp.lang.python
Message-ID <mailman.10373.1401220622.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I'm trying to track down a memory leak in a fairly large code.  It uses a lot of 
numpy, and a bit of c++-wrapped code.  I don't yet know if the leak is purely 
python or is caused by the c++ modules.

At each iteration of the main loop, I call gc.collect()
If I then look at gc.garbage, it is empty.

I've tried using objgraph.  I don't know how to interpret the result.  I don't 
know if this is the main leakage, but I see that each iteration there are more
'Burst' objects.  If I look at backrefs to them using this code:

   for frame in count(1): ## main loop starts here
        gc.collect()
        objs = objgraph.by_type('Burst')
        print(objs)
        if len (objs) != 0:
            print(objs[0], gc.is_tracked (objs[0]))
            objgraph.show_backrefs(objs[0], max_depth=10, refcounts=True)

I will get a graph like that attached

A couple of strange things.

The refcounts (9) of the Burst object don't match the number of arrows into it.
There are 2 lists with 0 refs.  Why weren't they collected?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

help with memory leak Neal Becker <ndbecker2@gmail.com> - 2014-05-27 15:56 -0400

csiph-web