There are a number of rules relating to memory management that
you must follow when developing web
service client applications.
- Objects that are passed to or obtained from the web service method as
pointers are the responsibility of the client application.
- Objects that are defined as a class hide the objects that they contain
and instead have get and set methods to manipulate the object contents.
- For objects that are classes and used as inputs, the client application
is responsible for the deletion of these objects when they are no longer required.
- For objects that are classes and used as outputs, the client application
is responsible for the deletion of these objects when they are no longer required.
They must not delete any object that is returned from a call to the ‘get’
method as this is deleted by the parent when the parent object is deleted.
- If a stub is "new"ed (rather than being a stack object), it must be deleted.
- Return parameters must be deleted when they are one of:
- Complex type
- Array
- String based type rule 7
- Nillable
- Optional
- When deleting string based types, use: delete [] string;.
The string based types are: xsd__string, xsd__normalizedString, xsd__token,
xsd__language, xsd__Name, xsd__NCName, xsd__ID, xsd__IDREF, xsd__IDREFS, xsd__ENTITY,
xsd__ENTITIES, xsd__NMTOKEN, xsd__NMTOKENS, xsd__anyURI, xsd__QName and xsd__NOTATION.
- The "set(xsd__unsignedByte * data, xsd__int size)" method on xsd__hexBinary
and xsd__base64Binary take a copy of the data. Remember to delete the original
data.
- When using the "xsd__unsignedByte * get(xsd__int & size) const" method
on xsd__hexBinary and xsd__base64Binary do NOT delete the returned pointer,
as this pointer is deleted by the destructor on the xsd__base64Binary or xsd__hexBinary
object.
- When setting members of complex types, the corresponding set method takes
a deep copy of the original data. Remember to delete the original data.
- Setting members of complex types directly (that is, not using the corresponding
set method) is not supported and may produce unknown side-effects.
- When initializing an Array (Axis_Array and its derivates - xsd__<built-in
simple type>_Array or <generated type>_Array) using the set() method takes
a deep copy of the data. Remember to delete the original array elements and
the original c-style pointer array.