# Memory management with monitor or an alternative to monitor

I often use Monitor[...] to watch the progress and behavior when batch fitting a lot of spectra. Usually I have no problem with this at all, I typically may fit something like 500 spectra at a time -- no issue.

However I have recently been using the same routine to fit 100,000 spectra. This works but then at some point in the evaluation, Mathematica behaves as though the local kernel has been quit. Removing the Monitor[...] and running the routine stops this kernel quit like behavior -- so I know the internal code is good.

I wonder is this an issue with memory, does monitor create a bunch of temporary variables that are loaded into memory, and not cleared until the operation is complete?

Usually I would provide a code sample, but I am using many custom modules..I am trying to replicate the problem with a minimal working example using native Mathematica functions and I will post it later if it works.

For now I just ask is: How does monitor work? Is it more memory intensive? Is there a way to clear/delete the local variable monitor generates?

• I think this will be hard without some sense of what your Monitor output is. We don’t need the fitting code, just something showing what you’re displaying on screen. – b3m2a1 Jun 26 at 18:49