Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'context': 0.05; '__init__': 0.09; 'happens.': 0.09; 'referenced': 0.09; 'worse': 0.09; 'cc:addr:python-list': 0.10; 'slightly': 0.15; '__slots__': 0.16; 'benjamin': 0.16; 'cc:name:python list': 0.16; 'disaster.': 0.16; 'fine.': 0.16; 'lambda': 0.16; 'subject:usage': 0.16; 'string': 0.17; 'wrote:': 0.17; 'string,': 0.17; "i'd": 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'originally': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'interface': 0.27; "doesn't": 0.28; 'subject:per': 0.29; 'objects': 0.29; 'class': 0.29; "i'm": 0.29; 'function': 0.30; 'expect': 0.31; 'code': 0.31; 'url:python': 0.32; 'received:209.85.160.46': 0.32; 'could': 0.32; "can't": 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'message- id:@gmail.com': 0.36; 'wanted': 0.36; 'url:org': 0.36; "didn't": 0.36; 'anything': 0.36; "i'll": 0.36; 'keeps': 0.37; 'does': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'sure': 0.38; 'header:Received:5': 0.40; 'between': 0.63; 'worth': 0.63; 'information': 0.63; 'alive.': 0.65; 'oscar': 0.84; 'overhead,': 0.84; 'severe.': 0.84; 'by.': 0.91; 'graphical': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=mvLRfjErwNw6OhFXvTvD4Bwo26zb0u65N5Hoousd+kM=; b=t+Ms2Wgd6S9IwSrczXbKAiWJ297FxXNpedp+L+4iUcUAfRLQUDCIeJxKyTtWYAEjJr N+UKdxgn+FxnMchxqHJbKfQLsLSkAZ0m5bK8IUicYEL85LKsp2h7bssiOPv6N/SVOZ8R AYX5I3Knhk/deGgysqGGB45wkLrJExm7t/OZAK1EkXVV3PusolKb4sNT6Nv2TfhUVD5k pkuKcKMNvrBXMAgqrLChFPrzYiNiDpm3FKJpDEqKD2y+xW1oiaYhQzcdHFTv1AGJhEjp BH6H4R60jYMFwCwLpU6u3sLSRF7HE7x89tqHXySjpLVAwXllTtFgAp1/PLfusXfTfcx+ /eaA== Date: Tue, 25 Sep 2012 14:35:28 -0700 From: Junkshops User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Oscar Benjamin Subject: Re: Memory usage per top 10x usage per heapy References: <983c532f-3ff6-4bd2-bb48-07cf4d065a4b@googlegroups.com> <5060EB2C.6080508@tim.thechases.com> <5060F3BB.7010706@gmail.com> <5061F31D.3020207@gmail.com> <5062135F.5010400@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Python List 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348608941 news.xs4all.nl 6934 [2001:888:2000:d::a6]:44075 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30128 On 9/25/2012 2:17 PM, Oscar Benjamin wrote: > I don't know whether it would be better or worse but it might be worth > seeing what happens if you replace the FileContext objects with tuples. I originally used a string, and it was slightly better since you don't have the object overhead, but I wanted to code to an interface for the context information so started a Context abstract class that FileContext inherits from (both have __slots__ set). Using an object without __slots__ set was a disaster. However, the difference between a string and an object with __slots__ isn't severe. > > I can't see anything wrong with that but then I'm not sure if the > lambda function always keeps its frame alive. If there's only that one > line in the __init__ function then I'd expect it to be fine. That's it, I'm afraid. > > Perhaps you could see what objgraph comes up with: > http://pypi.python.org/pypi/objgraph > > So far as I know objgraph doesn't tell you how big objects are but it > does give a nice graphical representation of which objects are alive > and which other objects they are referenced by. You might find that > some other object is kept alive that you didn't expect. > I'll give it a shot and see what happens. Cheers, MrsEntity