Re: Re: Kernel is quitting on me
Thanks everyone for the suggestion. At this point I am totally stuck
with two months worth of coding, a boss breathing on my neck, and a
program that can crash not only the kernel but now the front end,
depending on how I use it. I had to deal with some problems with our
Premier Service license, it looks like it will be solved but at
bureaucracy speeds, so I give it a month or two until I can send my
notebook to Wolfram tech support.
In the meantime, I was hoping that if I update the status of the
problem here somebody will see something that points to where my
I followed some people's suggestions and I Removed ALL variables that
are declared and used in Modules. In order to avoid further problems,
for each Module I created a special variable that is assigned the
number or list that gets Returned (this variable cannot be Removed).
This didn't work.
Then, I inserted Print[MemoryInUse] commands everywhere in all
modules to keep track of the memory usage, hoping to catch a memory
leak in action. Not only this didn't give me anything (memory is fine
until crash), but this made a full crash of both the kernel and the
front end...The only new bit of information is that before shutting
down, Mathematica gives an error message: "A Mathlink communication
error has occurred which Mathematica is unable to recover from". Funny
thing is, I am *not* using Mathlink at all! I thought that maybe this
could point to only a few functions that internally use Mathlink...
The other new symptom is that the crash has become more stable now.
Normally it will crash the *second* time I use my driver Module. I
still don't know what this means, but it could be useful.
Thanks for your attention,
PS: by the way it feels bad to crash Mathematica at will !
On Mar 25, 2009, at 11:45 AM, Fernando Cucchietti wrote:
> Thanks Sseziwa,
> yours was a very useful answer. I was also afraid that there could be
> a memory leak somewhere. However, I don't know how to track down the
> offending code. Any ideas?
> I Remove-d all variables from my modules (which were all properly
> defined as local anyway), except the one that gets returned as the
> output of the module. How could I do that? There are also "hidden"
> variables created inside each Module when computations are made, I
> guess I have to pray for those to be disposed of.
> Do you think that renaming all variables from all modules so that
> there are no two variables named the same could help? I mean, even if
> they are local to the module, could they collide and cause the leak?
> On Mar 24, 2009, at 2:17 PM, Sseziwa Mukasa wrote:
>> On Mar 24, 2009, at 6:28 AM, Fernando Cucchietti wrote:
>>> Hi all,
>>> I am testing a very long worksheet, and all the pieces seem to be
>>> working (separately). When I use the loop that puts them all
>>> the kernel quits after a few seconds (or at least, the equivalent of
>>> the kernel quitting: everything goes undefined and in a weird
>>> I've tried following the computation step by step and everything
>>> normal until it just hangs. Also it seems to hang at different
>>> everytime, but that *could* be that I am testing with a different
>>> random initial condition every time.
>>> I've checked if it is memory usage, it shouldn't be since the
>>> MaxMemoryUsed never goes above 15MB. I tried with $HistoryLength=0
>>> just in case. The kernel in Debugger mode also just quits.
>>> There is almost no symbolic manipulation either, just operations on
>>> lists with numeric values.
>>> I can't reproduce the error with simpler algorithms, and submitting
>>> the whole worksheet for other to find a bug seems too much.
>>> My question is then: What kind of things can cause this behavior?? I
>>> have really no clue since there are no error or warning messages,
>>> an ugly quit. I would appreciate at any pointers to where can I
>>> looking at...
>> I suspect you have a memory leak in a Module. I know Mathematica
>> is >
>> supposed to be garbage collected but in my experience I have found
>> routines that leak, my recommendation is to use Remove on any
>> variables created in modules. I don't know what kind of code you
>> are writing but I have also been able to cause some Mathematica
>> routines to crash on input that doesn't seem particularly special,
>> in particular I've seen SingularValueDecomposition fail on
>> seemingly =
>> innocuous numeric input.
>> Hope this helps,
Prev by Date:
Re: Asking PlotRange to take a Dynamic value
Next by Date:
Re: Detecting CD driver availability
Previous by thread:
Re: Re: Kernel is quitting on me
Next by thread:
Re: Kernel is quitting on me