How to free memory in program using glut?

hello all,

I’m thinking how to “delete[] something_pointer” using glut.

I can “new” memory before calling glutMainLoop(),
but how to “delete” it? It should follow glutMainLoop(), but this does not work because I test it that program doesn’t run thing after glutMainLoop().

you can use the atexit (or on_exit) function to
register a function that is called when glut exits

 void my_exit() {
printf("goodbye
");} 

void main(int argc, char *argv[]) {

atexit(my_exit);

// go on with glut here...
}

Thanks, RigidBody!

Originally posted by RigidBody:
[b]you can use the atexit (or on_exit) function to
register a function that is called when glut exits

 void my_exit() {
printf("goodbye
");} 

void main(int argc, char *argv) {

atexit(my_exit);

// go on with glut here…
}

[/b]