I'm using Visual Studio 2008, Developing an OpenGL window. I've created several classes for creating a skeleton, one for joints, one for skin, one for a Body(which is a holder for several joints and skin) and one for reading a skel/skin file.
Within each of my classes, I'm using pointers for most of my data, most of which are declared using = new int[XX]. I have a destructor for each Class that deletes the pointers, using delete[XX].
Within my GLUT display function I have it declaring a body, opening the files and drawing them, then deleting the body at the end of the display. But there's still a memory leak somewhere in the program. As Time goes on, it's memory usage just keep increasing, at a consistent rate, which I'm interpreting as something that's not getting deleted.
I'm not sure if it's something in the glut display function that's just not deleting the Body class, or something else. I've followed the steps for memory leak detection in Visual Studio 2008 and it doesn't report any leak, but I'm not 100% sure if it's working right for me. I'm not fluent in C++, so there maybe something I'm overlooking, can anyone see it?
From main:
void display(void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Body *body = new Body();
body->readSkel("C:\\skel2.skel");
body->drawBody();
body = new Body();
body->readSkel("C:\\skel1.skel");
body->drawBody();
glutSwapBuffers();
body->~Body();
delete body;
}
From Body:
Body::Body(){
skelFile = string();
skinFile = string();
totalJoints = 0;
joints = new Joint[25];
skin = new Skin;
}
Body::~Body(){
delete[25] joints;
delete skin;
}