[SciPy-user] How to free unused memory by Python

Gael Varoquaux gael.varoquaux@normalesup....
Sat Sep 1 03:04:39 CDT 2007


Can you send us a simplified version of your code, reflecting the way
you use both numpy arrays and lists, that triggers the crash? We can have
a look at the problem, that way.

Gaël

On Sat, Sep 01, 2007 at 07:43:01AM +0200, Robert VERGNES wrote:
>    Yes the issue is related with many numpy arrays ( not especially small>2
>    to 7million items in array). And I do have a crash usually while creating
>    a new array. (MemoryError). To check this out, I made a small test to
>    understand how memory is working in Python and got to see that even with a
>    'mylist=arange()' the memory is not freed back to the OS when 'mylist' is
>    deleted...which triggered my original question ' How to free unused memory
>    ..'. But as I read from you and other guys, the only way out of this issue
>    - ie to avoid crash -probably due to malloc()- then I must free memory
>    before and for that I need to process out my recurring calculation process
>    which is memory heavy temporarily and must kill my process to release
>    memory after work...
>    I did notice that if I use huge list -and only a standard python list- ,
>    then yes the OS pages normally the memory but when I mix list and numpy
>    arrays are involved than I do have  a crash when I run near the limit of
>    my physical memory -  no more paging possible....and a MemoryError crash
>    happens. Probably due to the way malloc() request the memory for the numpy
>    array...



More information about the SciPy-user mailing list