# CloneMeshFVF and memory leaks

This topic is 4712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all... I have a line in my code, that creates a copy of pOldMesh into pNewMesh:
pOldMesh->CloneMeshFVF(pOldMesh->GetOptions(), pOldMesh->GetFVF(), pDevice, &pNewMesh);

And its causing weird memory leaks (3 blocks)... do I need to use a tempMesh in between? do I need to AddRef()/Release() anything? when I comment this line out my program is mem leak free... Or could this be caused by other lines of the code? thanks very much in advance.... this is driving me nuts..! -fuchiefck

##### Share on other sites
Hi again... that was quick... I solved the problem..!

I forgot to mention before, that pNewMesh has a mesh loaded into it at the start... so I just added another line before the CloneMeshFVF...
pNewMesh->Release();pOldMesh->CloneMeshFVF(pOldMesh->GetOptions(), pOldMesh->GetFVF(), pDevice, &pNewMesh);

and now its fine... hmmm...

I think this is something I like about GameDev... when u are stuck at a problem for so long... you spend about 5 mins away from your program and post a question on GameDev, and when you go back to your program again... you seem to think about the problem from another point of view... and then vua la... you will probably come up with a new solution that solves your problem... GameDev is really helpful..!!

-fuchiefck

• 22
• 10
• 19
• 15
• 14