Hi,
When I have a class containing static stuff, how can I free the memory at the end of the application the best way?
Foo.h
class GLUtesselator;
class Foo
{
private:
static GLUtesselator *tess;
public:
Foo();
virtual ~Foo();
}
Foo.cpp
#include "Foo.h"
#include <GL/glu.h>
GLUtesselator *Foo::tess = gluNewTess(); // System call
Foo::Foo() {}
Foo::~Foo()
{
// And of course I don't want to destruct it here,
// because I'm going to use the tesselator in other instances of Foo
// Otherwise:
// gluDeleteTess(tess);
}
Are there better alternatives to making a method to remove static stuff and call it when the app terminates?
Or can I say: "Oh, whatever, the application is terminated. The OS will free the memory..." ?
Thanks