How to free memory when using boost::intrusive_ptr in C++?

317 Views Asked by At

I use boost::intrusive_ptr like this:

void func() {
    boost::intrusive_ptr < MyObject > obj = new MyObject();
    getStage()->addChild( obj );
}

If I understand this code right - here I get a memory leak because I don't free memory which was allocated for MyObject. How can I free it to avoid a memory leak?

0

There are 0 best solutions below