[VC++] Memory Leaks

Started by
32 comments, last by Ripiz 14 years, 6 months ago
Quote:<string> is already included in header, else it would(n't) allow to append

Nope. <vector> is sufficient for that. Make sure #include <string> is there.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Advertisement
It is included. And I got it fixed :D
Added this at the end of application, along with some other cleanups.
for(unsigned int i=0; i<Textures.size(); i++){	delete Textures;}



Now my Mtrls doesn't clean up =/
//definitionvector<Material> Mtrls;//codeD3DXMATERIAL *mtrls=(D3DXMATERIAL*)mtrlBuf->GetBufferPointer();for(DWORD i=0;i<NumMtrls;i++){		Material mat;	// other code	Mtrls.push_back(mat);}

'delete Mtrls' and 'delete [] Mtrls' don't work as it's not pointer, 'delete &Mtrls' and 'delete [] &Mtrls' throw errors

Leak data:
{1735} normal block at 0x06A7A378, 15192 bytes long. Data: <   ?   ?   ?   ?> 00 00 00 3F 00 00 00 3F 00 00 00 3F 00 00 00 3F 
//definitionvector<Material> Mtrls;


If Mtrls is a global, you need to dealocate the intern memory of the vector by using the swap-trick after you remove all data in Mtrls:

std::vector<Material>(Mtrls).swap(Mtrls);
It's defined in other class, but I will try

Edit:
It doesn't work =[

Edit again:
Appears I had to delete what was pointing to Model, it's fixed now.

[Edited by - Ripiz on October 17, 2009 11:51:39 AM]

This topic is closed to new replies.

Advertisement