Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.05; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; ':-)': 0.13; '(and,': 0.16; 'from:addr:pitrou.net': 0.16; 'from:addr:solipsis': 0.16; 'from:name:antoine pitrou': 0.16; 'gc.collect()': 0.16; 'heap': 0.16; 'measurement': 0.16; 'message-id:@post.gmane.org': 0.16; 'received:213.41.240': 0.16; 'received:213.41.240.54': 0.16; 'received:80.91.229.3': 0.16; 'received:charlus.yi.org': 0.16; 'received:plane.gmane.org': 0.16; 'received:yi.org': 0.16; "shouldn't": 0.17; 'variables': 0.17; 'precise': 0.22; 'header :User-Agent:1': 0.26; 'andrew': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'writes:': 0.29; "i'm": 0.29; 'figure': 0.30; 'could': 0.32; 'allocated': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'easy': 0.60; 'within': 0.64; '(global': 0.84; 'antoine.': 0.84; 'concepts,': 0.84; 'running,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Antoine Pitrou Subject: Re: Memory profiling: Python 3.2 Date: Fri, 2 Nov 2012 21:47:43 +0000 (UTC) References: <509425BB.30104@r3dsolutions.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 213.41.240.54 (Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351892880 news.xs4all.nl 6954 [2001:888:2000:d::a6]:53793 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32663 Andrew Robinson r3dsolutions.com> writes: > > When Python3.2 is running, is there an easy way within Python to capture > the *total* amount of heap space the program is actually using (eg:real > memory)? I'm not sure what you mean with "real memory" or how precise you want that measurement to be, but you could try http://www.selenic.com/smem/ (and, within Python, re-use smem's concepts, which shouldn't be too difficult) > And how much of that heap space is allocated to variables ( > including re-capturable data not yet GC'd ) ? Again, not sure what you mean with "allocated to variables" (global variables? local variables? everything?). As for "re-capturable data not yet GC'd", the best way to figure out is to run gc.collect() :-) Regards Antoine.