Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Steve_Browne
Beginner
85 Views

Intel G41 Chipset Direct3D Process handle leak (sample code included)

Intel G41 Express Chipset
Driver Date: 09/21/2010
Driver Version: 6.14.5303
OS: Windows XP Pro 32bit

I have an application that is used for videosurveillancethat is experiencing large memory leaks when using this chipset. I thought maybe it would be resolved by updating to the latest driver version (as of yesterday) which I listed above and that didn't seem to help. In fact, if anything I think it's now leaking more. What happens is that every time we call Direct3DCreate9() it will create 85 process handles and every time we call CreateDevice() to create our Direct3D device it will create an additional 171 process handles.

I've tried experimenting with different things. If I call Direct3DCreate9() and immediately release it then it will still leak the 85 handles. Similarly if I simply release the Direct3D device immediately after calling CreateDevice() without doing anything all those handles leak as well.

If I simply don't release either and leave re-use them for the duration of the application then no further process handles will be created. This part is a small improvement over my previously reported issue with the Intel 945 chipset drivers:

I'm reusing the same sample code from that issue to duplicate this here as well. I'm also using the SysInternals program handle in order to monitor the handles created by my application and determine what type of handles they are.

For convenience here is the sample code to reproduce the issue:

void PerformDirect3DTest(HWND hWnd)
{
HRESULT hr = S_OK;
CComPtr d3d = NULL;
CComPtr d3d_device = NULL;
d3d.Attach(Direct3DCreate9(D3D_SDK_VERSION));
// see what we can do with the graphics hardware before we try to do anything
D3DCAPS9 dxcaps;
D3DDEVTYPE devtype = D3DDEVTYPE_HAL;
DWORD dwFlags = D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE;
hr = d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, devtype, &dxcaps);
// If device doesn't support HW T&L or doesn't support 1.1 vertex
// shaders in HW, then switch to SWVP.
if (((dxcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0) || (dxcaps.VertexShaderVersion < D3DVS_VERSION(1,1)))
dwFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
else
dwFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
// Try to create the D3D device we need
D3DPRESENT_PARAMETERS d3dParam;
memset(&d3dParam, 0, sizeof(D3DPRESENT_PARAMETERS));
d3dParam.Windowed = true;
// since we use an additional swap chain we don't need the default backbuffer to be very big
d3dParam.BackBufferWidth = 1;
d3dParam.BackBufferHeight = 1;
d3dParam.BackBufferCount = 1;
d3dParam.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dParam.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
// this is the window handle of the renderer's video window
d3dParam.hDeviceWindow = hWnd;
// try to create a device to use based on the type and behaviour we figured out back in the constructor
hr = d3d->CreateDevice(D3DADAPTER_DEFAULT, devtype, NULL, dwFlags, &d3dParam, &d3d_device);
if (FAILED(hr))
return;
// Turn off alpha blending
if (FAILED(hr = d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)))
DXTRACE_ERR(TEXT("DirectX call SetRenderState failed"), hr);
// Set a larger backbuffer size for creating our swap chains
d3dParam.BackBufferWidth = 1920;
d3dParam.BackBufferHeight = 1080;
// Create swap chains until we run out of memory
CComPtr *pSwapChains = new CComPtr[256];
for (int i = 0; i < 256; i++)
{
// Create a new swap chain to use
hr = d3d_device->CreateAdditionalSwapChain(&d3dParam, &pSwapChains);
if (FAILED(hr))
{
DXTRACE_ERR(TEXT("DirectX call CreateAdditionalSwapChain failed"), hr);
break;
}
}
// Delete our array of swap chains which will also release them
delete [] pSwapChains;
pSwapChains = NULL;
// Not necessary since we're going out of scope, but we'll release anyway
d3d_device.Release();
d3d.Release();
}
0 Kudos
1 Reply
85 Views

Hi,

The G41 Express chipset is not being actively supported by the driver team, although they will continue to make and release drivers with planned improvements.

But, I will send your sample to our product support team and see if we can give you some guidance.

Thanks,
-Ganesh
Reply