deallocate object COM

Hi!,

I need deallocate when iPtr = new IPtr(__uuidof(EXAMPLE)).
How to do it?

Thks
we need to see the IPtr object definition.
what I know is that anything allocated with the new operator has to be deallocated with the delete operator.
COM Objects are usually instantiated with a function call not through the new operator and any instance of an object that inherits from the IUnknown interface has to be deallocated with the Release() function not the c++ delete operator, I hope I answered your question.
Last edited on
hi,

Definition is: IPtr iPtr = NULL;

Thks
that shouldn't compile then
you cannot do T *ptr = new T*;
it's either T *ptr = new T;
or T **ptr = new T*;


apart from that, RTFM to know if you need to call a special function to construct and destroy the object
if it is a kind of smart pointer
or if you are just abusing new
Topic archived. No new replies allowed.