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


Groups > comp.lang.python > #72125

help with memory leak

Path csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:help': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'empty.': 0.16; 'iteration': 0.16; 'modules.': 0.16; 'objects.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'code.': 0.18; 'bit': 0.19; 'trying': 0.19; 'result.': 0.19; 'things.': 0.19; 'starts': 0.20; 'memory': 0.22; 'header:User- Agent:1': 0.23; 'interpret': 0.24; 'fairly': 0.24; "i've": 0.25; 'code:': 0.26; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; "i'm": 0.30; 'purely': 0.31; 'lists': 0.32; 'subject:with': 0.35; 'but': 0.35; 'there': 0.35; 'c++': 0.36; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'track': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:o 30': 0.61; 'more': 0.64; 'here': 0.66; 'caused': 0.69; 'image-size:2**15': 0.72; 'leak': 0.84; 'received:139': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Neal Becker <ndbecker2@gmail.com>
Subject help with memory leak
Date Tue, 27 May 2014 15:56:43 -0400
Mime-Version 1.0
Content-Type multipart/mixed; boundary="nextPart18709298.xrLdHrxNQQ"
X-Gmane-NNTP-Posting-Host exa2-in-fw-01-epn.hns.com
User-Agent KNode/4.12.5
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10373.1401220622.18130.python-list@python.org> (permalink)
Lines 545
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401220622 news.xs4all.nl 2923 [2001:888:2000:d::a6]:33823
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72125

Show key headers only | 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