[SciPy-user] ipython memory leak

Keflavich keflavich@gmail....
Thu Apr 10 21:45:02 CDT 2008


I'm afraid I don't know what gdb is; is that related to pdb?

Anyway, it turns out running it in a loop doesn't cause any problems:
it won't crash if the code is looped over, only if it is called in
ipython.  It also proved difficult to run in pure python, probably
because I picked the wrong version of python / wrong startup file
(between scipy, scisoft, and macOS I had to strictly define where to
search for packages in ipython).

More tidbits:
  - I don't get a crash unless I'm using matplotlib, however I still
do use all of my computer's memory and drive it to a standstill
  - from that, I think the crash happens when pylab/matplotlib tries
to write to memory and gets only virtual memory, but that's a guess

So my best guess is that the %run magic is keeping everything in
memory for some reason?  That's as far as I can speculate.

Thanks for the help,
Adam

On Apr 10, 4:20 pm, "Robert Kern" <robert.k...@gmail.com> wrote:
> On Thu, Apr 10, 2008 at 12:45 PM,Keflavich<keflav...@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
> _______________________________________________
> SciPy-user mailing list
> SciPy-u...@scipy.orghttp://projects.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-user mailing list