octave-maintainers
[Top][All Lists]
Advanced

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

Re: Separation into dock widgets


From: John Swensen
Subject: Re: Separation into dock widgets
Date: Sat, 30 Apr 2011 10:22:49 -0400

On Apr 30, 2011, at 10:11 AM, John W. Eaton wrote:

> On 30-Apr-2011, John Swensen wrote:
> 
> | I just went and looked at the code for the symbol_record class and
> | it looks like the copy constructor only increased a reference
> | counter.  It actually doesn't do a deep copy as you expected.  I
> | noticed this because I went back to check why rand(10000,10000) in
> | Quint wasn't using 2 times as much memory as the same command in
> | just Octave.  I think this implies that despite the best intentions
> | of OctaveLink, carrying around a reference to variables still being
> | manipulated by the Octave internals destroy and thread-safetiness
> | that OctaveLink is intended to provide, as you could access these
> | references outside the Readline idle event loop.
> 
> Are you talking about copying octave_value objects?  If so, when you
> copy one, the reference count for the actual data should be
> incremented by the copy constructor or assignment operator.  Even if
> you modify a value in the GUI while Octave does the same internally,
> you should be OK, except that your changes in the GUI will not be
> reflected internally in Octave due to the copy-on-write mechanism used
> for octave_value objects.  Similarly, the changes to values inside
> Octave will not appear in the GUI until you ask for the values again.
> 
> | I don't know if it is a related problem (I expect it is), but if you
> | try to clear the large random matrix, Quint crashes.  Try: zz =
> | rand(10000,10000); clear zz This crashes every time on both Ubuntu
> | and OSX when updating the VariablesDockWidget. It doesn't happen for
> | certain smaller variables, but I'm not sure why.
> 
> How are you clearing the variable?
> 
> Can you tell me where the copies you are concerned about are being
> made?
> 
> jwe

Take a look at the lines 83-92 fetchSymbolTable() and lines 108-118 
currentSymbolTable() at
https://github.com/jacobdawid/Quint/blob/master/src/OctaveLink.cpp
Jacob is pushing a list of symbol_table::symbol_record objects into a list and 
then using them elsewhere.


The commands I use to cause the crash are:
zz = rand(10000,10000); 
clear zz 

The call stack says the crash occurs in ~octave_value, which is somehow a 
result of the following line of code
treeItem->setData(1, 0, QString(symbolRecord.varval().type_name().c_str()));
found on line 68 of the updateTreeEntry() function found at
https://github.com/jacobdawid/Quint/blob/master/src/VariablesDockWidget.cpp

John Swensen




reply via email to

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