View Full Version : How to free objects in C++ Builder

August 12, 2009, 10:37:53

I use IC in C++ Builder and I write a DLL in VC to wrap the functions of IC control.

The DLL works good, but when I create a FrameHandlerSink like following:

DShowLib::tFrameHandlerSinkPtr gs_pSink;

extern "C" DLLFUNC bool HVP_PrepareSink(int p_nBufCount) {
gs_pSink = DShowLib::FrameHandlerSink::create(p_nBufCount);

but how can I delete this object?

similar, the following codes have the same problem:
DShowLib::Grabber::tVidCapDevListPtr gs_pCaptureDevList;
extern "C" DLLFUNC int HVP_EnumCaptureDevice() {
gs_pCaptureDevList = gs_pGrabber->getAvailableVideoCaptureDevices();
how to free the gs_pCaptureDevList object?

When I do nothing about free the memory, the program will generate memory access error when it is closed.

what can I do?

thank you!

Stefan Geissler
August 12, 2009, 11:55:59

I would try to write gs_pCaptureDevList = NULL.

I have no experiences with C++ Builder.

August 13, 2009, 10:27:38
Thank you!