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


Groups > comp.lang.python > #72125 > unrolled thread

help with memory leak

Started byNeal Becker <ndbecker2@gmail.com>
First post2014-05-27 15:56 -0400
Last post2014-05-27 15:56 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#72125 — help with memory leak

FromNeal Becker <ndbecker2@gmail.com>
Date2014-05-27 15:56 -0400
Subjecthelp with memory leak
Message-ID<mailman.10373.1401220622.18130.python-list@python.org>

[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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web