Object destructor

The destruction operation destroys an object. Its name has the format <object>_Destroy().

The Destroy() operation calls the object's Cleanup() operation to clean up its links, then frees any memory allocated for the object.

For example, the Destroy() operation is generated for the object A:

void A_Destroy(A* const me) {
   if(me!=NULL)
      {
         A_Cleanup(me);
      }
   free(me);
}

The C_CG::Class::FreeMemory property and the C_CG::Event::FreeMemory property specify the string generated to free memory previously allocated for objects or events. This string is used in the Destroy() operation. The default value of this property is:

free($meName);

In generated code, the $meName keyword is replaced with the name of the object or event for which memory is being freed.


Feedback