Graphics properties as objects

Michael Goffioul michael.goffioul at gmail.com
Sun Jan 6 03:43:01 CST 2008


On 1/6/08, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> Maybe I'm missing something fundamental, but I don't understand why
> there would be a memory leak if the map contains values.  Can you give
> a simple example that shows why that would happen?

It would not leak the "property" object, but the underlying "rep" field,
which is a pointer. For fixed properties, that's not a problem, because
the rep points to some field of graphics_object, so it will be destroyed
with the containing object. However, for dynamic properties, this won't
be the case. In my understanding, adding a dynamic property would
be equivalent to something like:

    all_props["my_property"] = property (new string_property (...));

But you need someone responsible for deleting the string_property
object. That's why I thought about reference counting, as used elsewhere
in octave.

Michael.


More information about the Octave-maintainers mailing list