(fwd) reducing/measuring python memory usage

John Arbash Meinel john at arbash-meinel.com
Wed Nov 28 22:43:47 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> http://wingolog.org/archives/2007/11/27/reducing-the-footprint-of-python-applications
> http://guppy-pe.sourceforge.net/#Heapy
> 
> I haven't tried Heapy yet on Bazaar, but it might be interesting.
> Beyond just using it as developers it'd be good to have a way for
> users to run it and send us the output easily.
> 

Thanks for pointing this out. I remember coming across it in the past,
but it has been a while.

Unfortunately, at least with python2.4 and 2.5 I'm unable to compile it.
For either Cygwin or Win32 Python.

I'm getting:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c
/nologo /Ox /MD /W3 /GX /DNDEBUG -Ic:\Python24\incl
ude -Ic:\Python24\PC /Tcsrc/sets/sets.c
/Fobuild\temp.win32-2.4\Release\src/sets/sets.obj
sets.c
src\sets\sets.c(68) : error C2099: initializer is not a constant
src\sets\sets.c(68) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'NyHeapDef_
SizeGetter'

(I get several "initializer is not a constant" messages).

gcc actually gives the same error, but not quite as clearly:
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
- -I/usr/include/python2.5 -c src/sets/sets.c -o build/
temp.cygwin-1.5.24-i686-2.5/src/sets/sets.o

src/sets/sets.c:68: error: initializer element is not constant
src/sets/sets.c:68: error: (near initialization for
`nysets_heapdefs[0].type')
...


Oddly enough it builds on Mac OS X (python 2.4.3) and seems to work fine.

I tried using it on Tungsten, though, and it seems to crash with a
segfault. I think it has to do with 64-bit incompatibility.

I certainly see a few warnings about "comparison is always false because
of limited range of data type", and  "cast from pointer to integer of
different size".

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTe8jJdeBCYSNAAMRAu/pAJ4qR8pbP6UaRB+luRDvwV19zkO0zgCeJkDx
C0tHTzkNLZN0bMcq4mtfpuU=
=09+G
-----END PGP SIGNATURE-----



More information about the bazaar mailing list