Common Problems with C++-with-Ease programs

Under construction

You may also wish to look at Common problems with C-with-Ease.

Some common problems:


Problem: Crashes at end of program or as process exits

Cause: Problematic destructors

It is possible that objects that you have created are being destructed and that the destructors are accessing pointers that already have been deleted or were never allocated. You should ensure that the objects copy constructor and assignment operator behave appropriately, especially if the object was used in a C++-with-Ease operation. It may be that a pointer was passed to another process which then deleted it.

Cause: Incorrect marshalling.

Marshalling is used when passing parameters to functions and also when sending objects through contexts to processes that do not share memory with the sender. If the default marshal operators are used, then the object is binary-copied. If it contains pointers or is variably sized then problems will arise - either the remote process will not be able to access through the pointer, or (worse) the other process will modify or read some random part of memory. If an object contains pointers then custom marshalling operators should be written.

Cause: Contexts not using context marshalling

Context handles (what an Ease programmer holds) contain pointers to structures which hold a set of pointers to functions which marshal, unmarshal, and call the appropriate constructors and destructors. If a context does not use context marshalling, then these become shared between separate context handles and multiple deletes of a single object may occur.
Tim MacKenzie