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


Groups > comp.lang.python > #40828

pytracemalloc 0.7: new tool to track memory leaks in Python

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <victor.stinner@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.095
X-Spam-Evidence '*H*': 0.82; '*S*': 0.01; 'url:pypi': 0.03; 'operator': 0.03; 'output': 0.04; 'subject:Python': 0.05; 'filename': 0.07; 'python': 0.09; 'compute': 0.09; 'url:github': 0.09; 'file,': 0.15; 'independent,': 0.16; 'optionally': 0.16; 'other:': 0.16; 'to:name:python list': 0.16; 'memory': 0.18; 'delta': 0.22; 'names.': 0.22; 'example': 0.23; 'patch': 0.24; 'total:': 0.27; 'message-id:@mail.gmail.com': 0.27; 'source': 0.29; 'install': 0.29; 'url:python': 0.32; 'file': 0.32; '2006': 0.33; 'allocated': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'skip:. 20': 0.35; 'created': 0.36; 'tool': 0.36; 'url:org': 0.36; 'announce': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'release': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'most': 0.61; 'between': 0.63; 'helps': 0.63; 'show': 0.63; 'total': 0.65; 'includes:': 0.65; 'media': 0.66; 'targeted': 0.66; 'consumer': 0.67; 'products': 0.70; 'power': 0.74; 'information:': 0.74; 'products.': 0.74; 'brand': 0.78; '#1:': 0.84; '#2:': 0.84; 'devices,': 0.84; 'more:': 0.84; 'recompile': 0.84; 'subject:tool': 0.84; 'victor': 0.84; 'boxes,': 0.91; 'average': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=LX+mwDdCRscVEo8ZZHm96saCf/TkuQvmxTVSWJxHH5o=; b=0v8MdeIT0YNu0kOV5pGbA7aZtuc0j6AstiLsrRnxzvjAWPrxzYpjSzJvA3GGj/wo++ rqfzY5lwFutHQjapaPMWsdCpzyVTeLRO9O0mEMMm59KGXeG9P/hmVSu66vconI0D4S6y OXtvgKR5+SFrAQAI6vVYML0uYaRPybzWuiemi1ZyDKEfENabIjigE0nkNJ8/DWND8tNz 33g5xN9v3cPggkLgqlsc35Q6K+i1t8ihcDG0oHjdBHkO4wOo9swt5Fi4DKa7Ssl51Ddu rcx0QSt4H+aLNXzjARerUexzWQfBOjSd+uH/Pro1il8g1BxCTBn4ckq50oTP0Vnar+xa I+nA==
X-Received by 10.112.82.164 with SMTP id j4mr103756lby.112.1362691774404; Thu, 07 Mar 2013 13:29:34 -0800 (PST)
MIME-Version 1.0
From Victor Stinner <victor.stinner@gmail.com>
Date Thu, 7 Mar 2013 22:29:14 +0100
Subject pytracemalloc 0.7: new tool to track memory leaks in Python
To Python List <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3058.1362692142.2939.python-list@python.org> (permalink)
Lines 72
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362692142 news.xs4all.nl 6876 [2001:888:2000:d::a6]:33319
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40828

Show key headers only | View raw


Hi,

Wyplay is proud to announce the release of a new tool to track Python
memory allocations: "pytracemalloc".

https://pypi.python.org/pypi/pytracemalloc
https://github.com/wyplay/pytracemalloc

pytracemalloc provides the following information:

- Allocated size and number of allocations per file,
  or optionally per file and line number
- Compute the average size of memory allocations
- Compute delta between two "snapshots"
- Get the source of a memory allocation: filename and line number

It helps to track memory leaks: show directly in which Python files
the memory increases.

Example of pytracemalloc output (compact):

    2013-02-28 23:40:18: Top 5 allocations per file
    #1: .../Lib/test/regrtest.py: 3998 KB
    #2: .../Lib/unittest/case.py: 2343 KB
    #3: .../ctypes/test/__init__.py: 513 KB
    #4: .../Lib/encodings/__init__.py: 525 KB
    #5: .../Lib/compiler/transformer.py: 438 KB
    other: 32119 KB
    Total allocated size: 39939 KB

Example of pytracemalloc output (full):

    2013-03-04 01:01:55: Top 10 allocations per file and line
    #1: .../2.7/Lib/linecache.py:128: size=408 KiB (+408 KiB),
count=5379 (+5379), average=77 B
    #2: .../unittest/test/__init__.py:14: size=401 KiB (+401 KiB),
count=6668 (+6668), average=61 B
    #3: .../2.7/Lib/doctest.py:506: size=319 KiB (+319 KiB), count=197
(+197), average=1 KiB
    #4: .../Lib/test/regrtest.py:918: size=429 KiB (+301 KiB),
count=5806 (+3633), average=75 B
    #5: .../Lib/unittest/case.py:332: size=162 KiB (+136 KiB),
count=452 (+380), average=367 B
    #6: .../Lib/test/test_doctest.py:8: size=105 KiB (+105 KiB),
count=1125 (+1125), average=96 B
    #7: .../Lib/unittest/main.py:163: size=77 KiB (+77 KiB),
count=1149 (+1149), average=69 B
    #8: .../Lib/test/test_types.py:7: size=75 KiB (+75 KiB),
count=1644 (+1644), average=46 B
    #9: .../2.7/Lib/doctest.py:99: size=64 KiB (+64 KiB), count=1000
(+1000), average=66 B
    #10: .../Lib/test/test_exceptions.py:6: size=56 KiB (+56 KiB),
count=932 (+932), average=61 B
    3023 more: size=1580 KiB (+1138 KiB), count=12635 (+7801), average=128 B
    Total: size=3682 KiB (+3086 KiB), count=36987 (+29908), average=101 B

To install pytracemalloc, you need to patch and recompile your own
version of Python to be able to hook all Python memory allocations.

--

Wyplay was created in March 2006 in the south of France. Independent,
Europe-based, and internationally recognized, Wyplay’s TV-centric
software solutions power the world’s most popular operator and
consumer electronic brand names. Targeted products includes:
Connected-HDTVs, Media Center CE devices, HD IPTV boxes, DVB-S/C/T HD
STBs, and in-home media-HDD products.
http://www.wyplay.com/

Victor

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


Thread

pytracemalloc 0.7: new tool to track memory leaks in Python Victor Stinner <victor.stinner@gmail.com> - 2013-03-07 22:29 +0100

csiph-web