WineD3D refcounting fun part II :)

Stefan Dösinger stefandoesinger at
Fri Feb 24 13:36:11 CST 2006

> If you run the test on d3d9 or using oliver's full d3d8 patch, you'll
> notice that not all memory is returned when quitting the program. (In
> 3dmark2001 this is a big issue as because of this we are out of memory
> after running a few demos) The problem appears that wined3d surfaces
> contain a reference to the wined3d device. So when you run a game the d3d8
> and wined3d device refcounts are out of sync (the wined3d refcount is a lot
> higher because of all the refcounts from the surfaces).
Are you sure that the Direct3DDevice9 should be released? Windows addrefs the 
DirectDraw interface when a surface is created, I'd be surprised if Microsoft 
changed that behavior in d3d8 or d3d9. From your description I'd say that 
there are still Direct3D9 surfaces hanging, which shouldn't happen.

It could be that some surfaces(or textures) are in use by the WineD3DDevice, 
for example they are set as textures with IWineD3DDevice::SetTexture. 
Settexure addrefs the texture interface, which makes sense and is done by 
Windows too. This means that the textures must be unset before the surfaces 
and the device can be destroyed, if an app doesn't do so, I'd consider it 

I'll look at the multitexture demo, and I'll get an IRC client running. I've 
never used IRC before(shame on me), but I think it makes discussing this 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the wine-devel mailing list