[xsde-users] memory management of "variable length" elements

Ivan Le Lann ivan.lelann at free.fr
Tue Sep 7 13:24:44 EDT 2010


Hi all,

I played with XSDe/Hybrid 3.1 and I'm unsurprisingly very happy with it.
I do have one comment about "variable-length" (VL) elements.

The combination of these two facts :

1) VL elements have no copy constructors.
2) an element takes single ownership of its VL child elements.

does not help when you want to assemble an object from cached subparts.
It seems you're stuck to rebuild/reparse your subpart on each member setter call.

While I do understand the move against deep copy,
I see no "non destructive" shallow copy alternative.
Does anyone know an existing way to handle such "object assembling" with xsde ?



So far, the solutions I see would be to either :

1) use copy-on-write or shared pointer in containers of some user-listed VL types.
2) allow deep copy of some user-listed VL types.

At first sight, both ways imply a change in xsde compiler code,
and in non-generated libxsde/hybrid sequences templates.

While I would be happy to try one of these, I'm not sure I can call it a solution.

Regards,
Ivan.



More information about the xsde-users mailing list