From owner-freebsd-python@FreeBSD.ORG Thu Mar 17 18:32:02 2011 Return-Path: Delivered-To: freebsd-python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D941106566C for ; Thu, 17 Mar 2011 18:32:02 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99]) by mx1.freebsd.org (Postfix) with ESMTP id 48FE28FC0A for ; Thu, 17 Mar 2011 18:32:02 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from cswiger1.apple.com ([17.209.4.71]) by asmtp024.mac.com (Oracle Communications Messaging Exchange Server 7u4-18.01 64bit (built Jul 15 2010)) with ESMTPSA id <0LI7005GCQ0PSD90@asmtp024.mac.com> for freebsd-python@freebsd.org; Thu, 17 Mar 2011 10:31:38 -0700 (PDT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15,1.0.148,0.0.0000 definitions=2011-03-17_06:2011-03-16, 2011-03-17, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1012030000 definitions=main-1103170089 From: Chuck Swiger In-reply-to: Date: Thu, 17 Mar 2011 10:31:37 -0700 Message-id: References: To: Amit Dev X-Mailer: Apple Mail (2.1082) Cc: freebsd-python@freebsd.org Subject: Re: Python malloc issue? X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Mar 2011 18:32:02 -0000 On Mar 17, 2011, at 7:43 AM, Amit Dev wrote: > This is using 165MB of memory. I really don't understand where the > additional memory usage is coming from. [Size of both lists are same] > > Python 2.6.4 on FreeBSD 7.2. On Linux and windows both uses around > 100mb memory only. It's possible that Linux and Windows are using Python's malloc, whereas FreeBSD might be using the native PHK or JE malloc. (And it's not that surprising that different allocation patterns have different results in a garbage-collected environment.) http://docs.python.org/library/gc.html ...provides some info; consider importing gc and calling gc.collect() if you want to minimize the RAM needed to hold this big list of strings. Regards, -- -Chuck