Featured post
c++11 - External memory management and COM -
having trouble memory management of third party library. have source it's complex (com stuff), full of macros , annoying microsoft annotations, etc, , interacts library source of don't have boot. quick debug runtimes have shown it's leaking memory , in pretty big way. make extensive use of self-releasing pointers unique_ptr , know released created. option try , clean (and understand) source?
in addition, safe allocate com objects operator new, or have go in com heap?
com quite agnostic how allocate own com objects. created class factory , iunknown::addref , release methods keep reference count. using operator new in class factory , delete this
in release fine.
you have careful pointers return in interface methods. typical automation objects bstr , safearray indeed need allocated in com heap client code can release them. pretty hard mess up, api work.
the client code can responsible leak, fumbling reference count pretty standard com bug. easy diagnose when have access addref/release implementations. debugging in vista or win7 recommended, have better heap manager doesn't silently ignore attempts free memory wrong heap.
if you're pretty sure com server leaks isolate problem <crtdbg.h>
header , unit tests exercise interface methods.
- Get link
- X
- Other Apps
Comments
Post a Comment