octave-maintainers
[Top][All Lists]
Advanced

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

Re: RFC: Using Standard C++ library components in Octave


From: John W. Eaton
Subject: Re: RFC: Using Standard C++ library components in Octave
Date: Wed, 13 Nov 2002 11:03:58 -0600

On 13-Nov-2002, Paul Kienzle <address@hidden> wrote:

| How many things can we use from STL?

Octave currently uses list, stack, and map objects.

| If we are replacing octave_value_list, is this also a good time to 
| change how Octave manages values?

Maybe.  But octave_value_list is not really a list, it is implemented
using the Array<T> classes.  But it might make sense to do it
differently.

| Allocating objects on the stack
| and returning them from functions means that Octave is spending a
| lot of time in constructors, copy constructors and destructors.  If
| instead we were passing around references then much of that could be
| avoided.

I came across a message from you about this in the last few days (I've
been trying to clean out the backlog of messages/bug reports that I've
accumulated over the past couple of years, in case it wasn't obvious
from the recent traffic on the lists).  I was surprised by the
results you showed because the octave_value and octave_value_list
objects use reference counting and a custom allocator to help speed up
creating and copying.

I'd like to make things faster if we can still do it in a "safe" way.
What I want to avoid is code that uses pointers in a way that means we
are calling new/delete outside of constructors/destructors (seems to
me that is asking for memory leaks and segfaults).  The thing I like
about the current way things are written is that nearly everything can
be passed around as a value and memory management is greatly
simplified.  But reference counting is just a poor-man's garbage
collection scheme, right?  It's simple, but maybe not as good as we
could do.

jwe



reply via email to

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