[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fltk crashing octave
From: |
Ben Abbott |
Subject: |
Re: fltk crashing octave |
Date: |
Tue, 17 Jan 2012 20:20:35 -0500 |
On Jan 17, 2012, at 7:09 PM, Doug Stewart wrote:
> On Tue, Jan 17, 2012 at 6:04 PM, Doug Stewart <address@hidden> wrote:
>
>> On Tue, Jan 17, 2012 at 5:16 PM, Ben Abbott <address@hidden> wrote:
>>
>>> On Jan 17, 2012, at 4:21 PM, Doug Stewart wrote:
>>>
>>> > I see that there are more reports of octave crashing with fltk.
>>> > Ben says that he can't reproduce the crash, but I can.
>>> > Ben knows this part of the system and I don't.
>>> > So if Ben will guide me I will do the debugging here.
>>> > I just pulled that latest tip, so where should I start????
>>> >
>>> > I think we should start with the fact that if I make plot and just double
>>> > click with the right button, it immediately crashes.
>>> >
>>> > What file would this be in?
>>> >
>>> > Would it be in fltk??
>>> >
>>> >
>>> > Doug Stewart
>>>
>>> Doug,
>>>
>>> I'm happy to help.
>>>
>>> Can you give me a simple script that demonstrates the problem.
>>>
>>> Ben
>>
>> Jordi and I have started looking ;at it.
>>
>> I ran octave in db
>>
>> I then did
>> plot(1:9)
>> and double clicked in the window with the right mouse button.
>> it crashed, and then I got a back trace
>> see
>> http://ubuntuone.com/2BKaTANezvGFMliPdLFbRr
>>
>>
>> I have graphic.cc in an editor now, but am not sure where the problem is yet.
>
> I have traced it to
> dim-vector.cc
>
> octave_idx_type
> dim_vector::safe_numel (void) const
> {
> octave_idx_type idx_max = dim_max ();
> octave_idx_type n = 1;
> int n_dims = length ();
>
> for (int i = 0; i < n_dims; i++)
> {
> n *= rep[i];
> if (rep[i] != 0)
> idx_max /= rep[i];
> if (idx_max <= 0)
> throw std::bad_alloc ();
> }
>
> return n;
> }
>
> This is where "throw std::bad_alloc ();" comes from
>
> Ben--- what should i do next??????
>
> Doug
Beyond the superficial, I'm not much use on the c++ side. You mentioned Jordi,
so Iv'e cc'd him. I'll try to give some insight ... and hopefully he (or
someone else) will correct my mistakes.
Regarding the error, see the link below.
"Type of the exceptions thrown by the standard definitions of operator new
and operator new[] when they fail to allocate the requested storage space."
-- http://www.cplusplus.com/reference/std/new/bad_alloc/
Lines 37-51 of dim-vector.h give a description of what is stored in "rep". It
looks (to me) to be equivalent to ...
[rep(1:end)] = size (...)
If I understand what safe_numel is doing, it take the allocated storage and
iteratively divides by the lengths of each dimension. When done it should be
equal to 1. If it rounds to zero, then the allocation failed.
I suggest you try to determine what was being allocated, and what are the
values of n_dims, rep[1:end], and idx_max.
My gdb skills are rather poor. If someone else can't help out there, please
check the documentation to figure out how to do that.
Ben
Re: fltk crashing octave, Ben Abbott, 2012/01/17