[SciPy-user] ipython memory leak

Robert Kern robert.kern@gmail....
Thu Apr 10 17:20:10 CDT 2008

On Thu, Apr 10, 2008 at 12:45 PM, Keflavich <keflavich@gmail.com> wrote:
> Hi, I'm running a script that loads a lot of fits images into the
>  global namespace; I need at least most of them to be present for
>  debugging purposes.  However, every time I re-run the script, it
>  consumes exactly the same amount of memory: nothing is freed even
>  though all of the variables are overwritten.  I've tried playing with
>  the gc module and %clear out and manually deleting the variables, but
>  the memory is never freed.  After 2-3 runs, ipython crashes
>  complaining of a memory issues.  Plotting with matplotlib may be part
>  of the problem, but the memory leak (?) still occurs if I remove the
>  plotting commands.  Any tips on cleaning things up?
>  The memory error:
>  python2.5(751) malloc: *** mmap(size=102875136) failed (error code=12)
>  *** error: can't allocate region
>  *** set a breakpoint in malloc_error_break to debug

Can you put a loop at the top of your code so that it runs 3-4 times
just as a script without ipython? If you can run your script using gdb
with a breakpoint set in malloc_error_break, you could give us a
backtrace that might help us pin down the problem.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the SciPy-user mailing list