Sign in to follow this  
NateDogg1848

weird memory leak (SOLVED)

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[i].iNumIndices); m_pMesh[i].iNumIndices*=3; m_pMesh[i].pIndices = new int[m_pMesh[i].iNumIndices]; int a,b,c; for(e=0; e<m_pMesh[i].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[i].pIndices[e]=a; //m_pMesh[i].pIndices[e+1]=b; //m_pMesh[i].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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this