学习交流群:622684416
#include <windows.h>
#include <tchar.h>
#include <atlbase.h>
#include
#include
#include <atlbase.h>
#include <dshow.h>
#include <ks.h>
using namespace std;
int main(int argc, char *argv[])
{
int index = 0;;
for (;😉
{
if (index == 20000)
{
// break;
}
cout << index++ << endl;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
//视频捕捉图形管理器接口
CComPtr pCaptureGraph; // Capture graph builder object
//图形管理器接口
CComPtr pGraph; // Graph builder object
HRESULT hr = pCaptureGraph.CoCreateInstance(CLSID_CaptureGraphBuilder2);
hr = pGraph.CoCreateInstance(CLSID_FilterGraph);
Sleep(30);
if ((pGraph))
{
(pGraph).Release();
(pGraph) = NULL;
}
if ((pCaptureGraph))
{
(pCaptureGraph).Release();
(pCaptureGraph) = NULL;
}
CoUninitialize();
cout << “Close” << endl;
}
return 0;
}
内存一直增加
没有找到directshow相关说明,采取折中方法解决此问题,采用单例方式,或者全局方式来使用directshow,将释放扔给进程来处理