Releasing Memory?
Posted: 30.06.2003, 00:29
[WARNING: Possible newbie developer question ahead.]
I am working on my own front-end to Celestia, using the engine and other libraries, but replacing the UI with one of my own design. I am having problems with memory leaks: none of the stars and other Celestia objects are apparently being freed in my code. I would like to know how I should be releasing the Celestia objects.
This is on the Windows platform with Visual C++ .NET (original, not yet upgraded to ViC++.NET 2003). Following devguide.text and the example of the existing Celestia front-end code, I:
1) Create a new Universe.
2) Load the star names with a call to StarNameDatabase::readNames().
3) Load the stars with a call to StarDatabase::loadBinary().
4) Call StarDatabase::finish().
5) Call Stars::setNameDatabase() with the StarNameDatabase from step 1.
6) Call Universe::setStarCatalog().
7) Call LoadSolarSystemObjects() to load the solar system.
During my application's clean-up sequence, I delete the resulting objects in the following order:
1) SolarSystemCatalog
2) StarDatabase
3) StarNameDatabase
4) Universe
Executing just the above sequence (load and immediately clean-up, no rendering or anything), the VC++ debug run-time reports literally thousands of memory leaks. If I don't load any Celestia objects, I have no leaks. What is the correct procedure for releasing the loaded Celestia objects?
Thanks in advance!
I am working on my own front-end to Celestia, using the engine and other libraries, but replacing the UI with one of my own design. I am having problems with memory leaks: none of the stars and other Celestia objects are apparently being freed in my code. I would like to know how I should be releasing the Celestia objects.
This is on the Windows platform with Visual C++ .NET (original, not yet upgraded to ViC++.NET 2003). Following devguide.text and the example of the existing Celestia front-end code, I:
1) Create a new Universe.
2) Load the star names with a call to StarNameDatabase::readNames().
3) Load the stars with a call to StarDatabase::loadBinary().
4) Call StarDatabase::finish().
5) Call Stars::setNameDatabase() with the StarNameDatabase from step 1.
6) Call Universe::setStarCatalog().
7) Call LoadSolarSystemObjects() to load the solar system.
During my application's clean-up sequence, I delete the resulting objects in the following order:
1) SolarSystemCatalog
2) StarDatabase
3) StarNameDatabase
4) Universe
Executing just the above sequence (load and immediately clean-up, no rendering or anything), the VC++ debug run-time reports literally thousands of memory leaks. If I don't load any Celestia objects, I have no leaks. What is the correct procedure for releasing the loaded Celestia objects?
Thanks in advance!