weird memory leak (SOLVED)
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]
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
minerjr
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement