gerardorosiles / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

SlimDX.Direct3D9.Mesh does not clean up owned VertexBuffer and IndexBuffer #774

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SlimDX.Direct3D9.Mesh does not clean up its owned VertexBuffer and IndexBuffer. 
This feels wrong, because the Mesh created these (hence my description as 
'owned') so it should also clean them up. Accessing a property on a Mesh 
instance does not show me clearly that a new object is instantiated or that it 
has become my responsibility for cleaning up.

Steps to reproduce:
- Start Direct3D
- Instantiate a SlimDX.Direct3D9.Mesh (for example, use Mesh.CreateBox())
- Access the VertexBuffer or IndexBuffer property. (for example set 
d3ddevice.Indices = mesh.IndexBuffer)
- Dispose your Mesh (mesh.Dispose())
- Shutdown Direct3D
- Notice memory leaks in the debug log

Temporary workaround:
- Dispose the VertexBuffer and IndexBuffer manually 
(mesh.VertexBuffer.Dispose(), mesh.IndexBuffer.Dispose() then mesh.Dispose())

Original issue reported on code.google.com by klapstoe...@gmail.com on 22 Jan 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Resolved in r1891.

Original comment by Mike.Popoloski on 22 Jan 2011 at 7:33