[geos-devel] Unclear objects lifetime and ownership issues in
Monotone Chain components
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Thu Sep 25 13:46:54 EDT 2008
On Thu, 2008-09-25 at 09:05 -0700, Martin Davis wrote:
> Mateusz,
>
> IMO you're on the right track with the idea that
> MCIndexSegmentSetMutualIntersector owns the segChains that it
> allocates. They can be deleted in it's destructor.
>
> I don't see the design problem. What's wrong with having complex
> long-lived structures which allocate internal objects, and then free
> them when the structure is itself destroyed?
Right. I inferred from Mateusz's comments that there were problems with
circular references which couldn't be sorted out in a straightforward
manner by fixing the constructors/deconstuctors. That's why I was
suggesting that if this is the case then a different design should be
considered.
But if each object has a well defined set of internal objects which can
be freed upon destruction, then that is a different matter - in this
case either someone will need to fix them by hand - or preferably
implement hierarchical memory management.
Martin, would there ever be a case where a hidden internal object could
be shared between multiple parent objects?
ATB,
Mark.
More information about the geos-devel
mailing list