help-octave
[Top][All Lists]
Advanced

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

memory management and copy-constructors


From: en254
Subject: memory management and copy-constructors
Date: Mon, 29 May 2000 20:46:38 -0400 (EDT)

I'm trying to understand how to manage memory with
extension types to octave.

I know that octave keeps reference counters for built
in types, thus avoiding unnecessary copying.

I'm wondering if extension types need to duplicate
this functionality or if it is inherited from the
base octave classes.

I've taken a look at the copy-constructor in 
make_int.cc, but since it doesn't need to manage
dynamic memory, it doesn't reveal much

--------cut from make_int.cc ------------
class
octave_integer : public octave_base_value
{
public:
...
  octave_integer (const octave_integer& s)
    : octave_base_value (), scalar (s.scalar) { }
...
--------cut from make_int.cc ------------

Additionally, if I put debug print statements in
the copy-constructor, I never see it used.

My question:

1 When is the copy-constructor used?

2 Do extension classes need to manage their own
  reference counting?


_______________________________________________________
Andy Adler,                               address@hidden




-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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