Fixing memory leaks.

Started by
3 comments, last by xegoth 19 years, 6 months ago
I've got a memory leak that I can't track down for the life of me. Is there any free software out there that'd help me find it? I'm using Microsoft Visual Studio .net and DX 9.0c
Advertisement
How are you being informed that you have a memory leak? i.e. is the DirectX Debug telling you? Is it crashing your software? What're the symptoms and maybe we can help? Some things to keep in mind. You should release all COM objects, even ones you didn't create (unless they are released elsewhere). An example of this is the D3DXBUFFER(I forget the exact COM) that is created when using D3DXLoadMeshFromX function. You create a pointer to a buffer at design-time, pass the address of the pointer to the function which then fills the pointer at run-time. Then you must release this when you're done. There are quite a few places in DirectX where you must release something you didn't specifically create. You didn't specifically call a CreateBuffer function, but you do have to release it. Off the top of my head, make sure you release at least these: Cursors, surfaces, textures, meshes, materials, buffers, vertex and index buffers, etc.

Chris
Chris ByersMicrosoft DirectX MVP - 2005
Hi, well about a free code you could use to track mem leaks, I suggest you check the fluid studios memory manager, it is a really easy to use industrial strenght mem leaks tracker.

Check it out in the following link:
http://www.fluidstudios.com/pub/FluidStudios/MemoryManagers/Fluid_Studios_Memory_Manager.zip

Regards,
Oscar
Quote:Original post by ogracian
Hi, well about a free code you could use to track mem leaks, I suggest you check the fluid studios memory manager, it is a really easy to use industrial strenght mem leaks tracker.

- If you have VC++, it already has such functionality (lookup _CrtSetDbgFlag or something)
- This won't work with DirectX (COM) memory leaks

The DirectX Debugger is informing me of the memory leak. It's small but bad all the same.

This topic is closed to new replies.

Advertisement