octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation Fault with Octave MXE under Windows


From: Daniel J Sebald
Subject: Re: Segmentation Fault with Octave MXE under Windows
Date: Thu, 29 May 2014 11:32:31 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 05/29/2014 11:13 AM, ijourneaux wrote:
Daniel Sebald wrote
My suspicion is that destructor is using "rep" pointer that isn't
initialized properly or whose memory has already been deleted.  I think
John would have the most educated guess on this one.  But try tracking
down exactly what command it is that is causing the segfault.  Copy the
imread() test code into a separate script file and then use the debugger
to step through that code and into the imread() command.

Dan just to clarify, the steps required to reproduce the seg fault

test imread but itself doesn't cause the fault. The fault only shows up when
you go to exit Octave.

OK, I see.

It looks like others explored the multi-thread issue, i.e., that two threads might be call the destructor at the same time. However, I'd think there should be some randomness to that, i.e., sometimes fails, sometimes not. However, it appears you tried with octave-cli (single thread) and there is still a segfault.

 The only way to reliably see the error is to run
octave in a dos window or in the debugger.

I will follow up with more info on the questions you asked shortly.
Ian

Alright, thanks.

Oh wait. I think there may be a problem here with the destructor. It can't be called when "rep" goes out of scope:

If this destructor is called such that "delete rep" occurs, and then it is called again, rep is out of scope and trying to access rep->count fails. Try changing this hunk of code to something like the following:

  virtual ~Array (void)
  {
    if (!rep)
      return;

    if (--rep->count == 0)
    {
      delete rep;
      rep = NULL;
    }
  }

If that fixes the problem, then we need a changeset for that (one that makes sure "rep" is initialized properly at the constructor.

Dan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]