Python and Memory
Oren Tirosh
oren-py-l at hishome.net
Thu Oct 2 06:37:49 EDT 2003
On Thu, Oct 02, 2003 at 04:59:15AM +0000, Ben Fairbank wrote:
> I have to pick a language to commit to for general purpose
> scientific/statistical/utility/database programming at my office and
> have pretty much narrowed it down to R or Python. Problem: none of
> the various Python books I have looked into has had much to say about
> memory. I will be operating on some big arrays, probably with Numpy;
Python isn't terribly memory-efficient. Every int, for example, takes all
the overhead of an object plus any allocator overheads. But if the bulk
of the data is going to be numpy arrays this isn't a problem. An array
object has a small one-time overhead and then each item takes exactly its
native size in bytes. Make sure you use in-place operations as much as
possible on arrays so you don't force numpy to allocate large temporary
arrays.
> if I run out of space and upgrade a Win 2000 or Win XP pro machine
> from 256 Meg to 500Meg or even 1G will Python automatically recognize
> and take advantage of the increase? Where are questionss such as this
> discussed in the documentation?
Python can immediately use any memory expansion. It also runs on 64 bit
platforms if you ever need more than 4GB of data.
Oren
More information about the Python-list
mailing list