[omniORB] Overloading the new and delete operators and the omniORB

Tom Haggie THaggie@img.seagatesoftware.com
Tue, 28 Apr 1998 09:15:53 -0700


Hello,

In our code we have overloaded the new and delete operators 
to give us some extra functionality. However, in the omni code
it is possible (through the inlines) for something to be created
with new in the omni code and destroyed with the delete in
our code thus causing an exception as we always allocate more
memory than is needed to store extra information we need. So
our delete is trying to delete one of the omni memory blocks 
rather than one of is own and so frees the wrong pointer.

The code that's giving us grief is in omniIternal.h

  inline ~omniRopeAndKey() { 
    if (pd_keysize > sizeof(omniObjectKey)) {
      delete [] pd_keyptr;  // calls our delete rather than omni's
    }
  }

Has anyone come across this problem before and more
importantly does anyone have any suggestions as to how
we can solve this problem?

-*TOM*-