MemoryError using NumPy

Gustavo Cordova gcordova at hebmex.com
Fri Feb 15 15:01:12 EST 2002


> > I suspect that memory has fragmented such that a sufficiently
> > large contiguous block is not available to set up the array.
> > Is this the likely cause, and if so is there a way to un-fragment 
> > memory? Or might there be an alternative to Numeric.take that
> > gets to the same place?

Er... This isn't an Amiga, you know. :-)

Really. Under UNIX, or anything "Unixy", where there's
a memory management unit on the CPU and a virtual memory
subsystem in the OS, memory fragmentation really doesn't
mean much, because the OS remaps the memory layout
so that each and every process receives (virtually) the
same memory space, in a contiguous manner.

I remember having to reboot my Ami because I didn't have
enought ram left, when in fact it was all fragmented.
Virtual memory would have been good then.  :-)

(regardless, they rocked)

> I think you have two functions in one line that create a copy (take()
> and astype()). I have never gotten an answer as to when CPython frees
> the memory for temporary variables in one statement, but if you can
> delete myDataArray before calling astype(), you might save something
> there.

The problem is the C library, seems like it doesn't ever return
allocated-and-then-freed memory to the OS, so, CPython never
returns unused memory to the OS neither.

> 
> If not, I'm interested in finding oput what the options are for memory
> defragmenting...
> 

No need, don't you worry about this.

>
> I'd also be interested in what happens under Linux, I still have a much
> better feeling about the robustness of Linux over Win2k, I'd like to see
> if they are different in this respect.
>

Different how?

WinNT/2000 has virtual memory management also, so they do the
remapping dance also. They're pretty robust, both of them.

BUT, if you wanna, you can rip out Linux's VM system and
install your own if you feel like it, but you can't do that
on windows. :-/

>
> -Chris
> 

TGIF!!!

-gustavo




More information about the Python-list mailing list