Jump to content
  • Advertisement
Sign in to follow this  
NateDogg1848

weird memory leak (SOLVED)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

For some reason the following code is creating a memory leak according to the d3dx debugger in visual studio .net 2003. After commenting / uncommenting code i narrowed it to this block, and specifically to a call to my readstr function (which is essentially a call to fgets()). I use fgets() many other times in my engine with no issues. Any ideas??? // Get the indices readstr(f,buf); sscanf(buf,"%d faces",&m_pMesh.iNumIndices); m_pMesh.iNumIndices*=3; m_pMesh.pIndices = new int[m_pMesh.iNumIndices]; int a,b,c; for(e=0; e<m_pMesh.iNumIndices; e+=3) { //readstr(f,buf); fgets(buf,255,f); // <--------THIS IS THE LINE THAT DOES IT //sscanf(buf,"verts(%d %d %d)", &a, &b, &c); //m_pMesh.pIndices[e]=a; //m_pMesh.pIndices[e+1]=b; //m_pMesh.pIndices[e+2]=c; } [Edited by - NateDogg1848 on June 11, 2005 9:42:15 PM]

Share this post


Link to post
Share on other sites
Advertisement
How big is buf? Is it a character array of size 255? That could be causing problems for you. Showing the entire code for the function could also help figure out the problem.

minerjr

Share this post


Link to post
Share on other sites
Yeah buf is a 256 char array. But i figured out that this memory leak only happens when i try to load my skydome mesh so i'm assuming there is something wrong with the file. Everything else is fine, just a random issue.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!