From owner-freebsd-python@FreeBSD.ORG Thu Mar 17 15:14:25 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 B6856106566B for ; Thu, 17 Mar 2011 15:14:25 +0000 (UTC) (envelope-from amitdev@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 74E6D8FC12 for ; Thu, 17 Mar 2011 15:14:25 +0000 (UTC) Received: by vxc34 with SMTP id 34so3036667vxc.13 for ; Thu, 17 Mar 2011 08:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=7AnHoyfv//IpPP8rzK4jRtGlGTIdx3Sy8JaTJXJILl0=; b=N09nqXISrGf6gKOD+WITv7w/whAz7WMN6DEzKaqvoyFFJe7ruxvaAzYimooC8NrjUY nXH0ft6NirB9CEDC6J5TC0BTqSHL7KsAVPBWPIgozf25RX11gDFSmqXVLI+8cw9AxlGZ XHALANnQki6iHkBaZ6X0STe9fbLS7GhiqTYvo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=rG0NKlYJiRNbKjfxAdLyKOZNHDlTE6nZrV2VWHyTiu13TKl+VmjMdLrwfHVIkXWgCj 6ZqtJplPRRvwXxRTe8oVZqO/TsAxPXG3patEaUaO8uz7gjQ2lkp5InH9rKPb5FTyZeFK ePiLtbt0UsZZZXhRb+PZIggxNpjvgu2dBDkEE= MIME-Version: 1.0 Received: by 10.220.158.146 with SMTP id f18mr360153vcx.177.1300372983715; Thu, 17 Mar 2011 07:43:03 -0700 (PDT) Received: by 10.220.177.3 with HTTP; Thu, 17 Mar 2011 07:43:03 -0700 (PDT) Date: Thu, 17 Mar 2011 20:13:03 +0530 Message-ID: From: Amit Dev To: freebsd-python@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: 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 15:14:25 -0000 I'm observing a strange memory usage pattern with python strings on Freebsd. Consider the following session. Idea is to create a list which holds some strings so that cumulative characters in the list is 100MB. >>> l = [] >>> for i in xrange(100000): ... l.append(str(i) * (1000/len(str(i)))) This uses around 100MB of memory as expected and 'del l' will clear that. >>> for i in xrange(20000): ... l.append(str(i) * (5000/len(str(i)))) 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. Regards, aMit