python memory use

Paul Rubin http
Wed Sep 30 21:32:59 CEST 2009

Gary Robinson <garyrob at> writes:
> I'd be interested in knowing whether anybody can share info about
> how representative those test results are. For instance, suppose
> we're talking about a huge dictionary that maps integers to lists of
> integers (something I use in my code). Would something like that
> really take up much more memory in Java (using the closest
> equivalent Java data structures) than in CPython? I find it hard to
> believe that that would be the case, but I'm quite curious.

Arrays of Java ints would use less memory than lists of Python's boxed
integers.  If you want unboxed ints in Python, use the array module.

More information about the Python-list mailing list