|
-
April 25th, 2004, 12:50 AM
#1
Memory leaks using CTypedPtrArray
I'm getting memory leaks out the wazoo in this class I'm trying to write. I'm just reading data from a file into a CTypedPtrArray-derived class. Don't classed derived from this template automatically deallocate themselves? If so, what might I be doing wrong?
unsigned short nVertexCount;
myFile.Read(&nVertexCount, sizeof(unsigned short));
m_lstVertices.SetSize(nVertexCount);
int nIndex, nIndex2;
for (nIndex=0; nIndex<nVertexCount; nIndex++)
{
CMS3DVertex* myVertex;
m_lstVertices[nIndex] = new CMS3DVertex;
myVertex = m_lstVertices[nIndex];
myFile.Read(&myVertex->m_cFlags, sizeof(unsigned char));
myFile.Read(myVertex->m_afVertex, sizeof(float) * 3);
myFile.Read(&myVertex->m_cBoneID, sizeof(char));
myFile.Read(&myVertex->m_cRefCount, sizeof(unsigned char));
}
Anything jump out?
The other classes are loaded similarly. The entire code can be found in a link at the bottom of the page: http://daltxcoltsfan.tripod.com - to get it up and running, look in the Initialize() routine in main.cpp and set the path the the ms3d file correctly, then the cursor keys move around and stuff.
As always, help appreciated!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|