For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

[Bug report] Missing delete operator for placement new

Roman Lygin's picture

OCC classes generated by WOK redefine a placement new operator:
void* operator new(size_t,void* anAddress)
return anAddress;
However there is no pair delete operator, which must be empty and as follows:
void operator delete (void*, void*)

Lack of this leads to numerous warnings that memory will not be freed if the constructor raises an exception.


class MyPnt : public gp_Pnt
#if 0
//compilation warning unless defined
void operator delete (void*, void*)
cerr }

#if 0
//you may want to throw an exception here
throw int (0);

char b[sizeof (MyPnt)];
new (b) MyPnt();
reinterpret_cast (b)->~MyPnt();

The fix should be made in WOK generator, for all hierarchies (gp_Storable, Standard_Transient, Standard_Persistent, classes manipulated by value).

By the way, using this opportunity you may want to revisit WOK generator to avoid generation of redundant redefinitions of new/delete operators in subclasses of Standard_Transient and Standard_Persistent, as definition in a base class is sufficient.

Forum supervisor's picture

Dear Roman,
I would like to inform you that the posted problem has been checked confirmed.
The corresponding issue with ID = 22815 has been registered.
Later you may check if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.

Fotis Sioutis's picture

Dear Forum Supervisor

Please note in your internal tracker that 'placement delete' should be protected by macros for compilers that support it.In my case borland c does not support it.I am not sure if there are any other compilers that do not support it.

ps : borland compilers define __BORLANDC__ macro

Forum supervisor's picture

Dear Fotis,
Your remark is registered and will be taken into account.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.