- getting fanatical about memory cleanup so that valgrind output is more useful

This commit is contained in:
Mark Vejvoda
2011-09-30 23:55:07 +00:00
parent b57fb0ff39
commit 77a2fa7d48
6 changed files with 84 additions and 84 deletions

View File

@@ -273,23 +273,16 @@ T* FileReader<T>::readPath(const string& filepath, T* object) {
template <typename T>
FileReader<T>::FileReader(std::vector<string> extensions): extensions(extensions) {
getFileReaders().push_back(this);
//string const * nextExtension = extensions;
std::vector<string> nextExtension = extensions;
//while (((*nextExtension) != "")) {
for(unsigned int i = 0; i < nextExtension.size(); ++i) {
//vector<FileReader<T> const* >* curPossibleReaders = (getFileReadersMap())[*nextExtension];
vector<FileReader<T> const* >* curPossibleReaders = (getFileReadersMap())[nextExtension[i]];
if (curPossibleReaders == NULL) {
//(getFileReadersMap())[*nextExtension] = (curPossibleReaders = new vector<FileReader<T> const *>());
(getFileReadersMap())[nextExtension[i]] = (curPossibleReaders = new vector<FileReader<T> const *>());
}
curPossibleReaders->push_back(this);
//++nextExtension;
}
}
/**Gives a quick estimation of whether the specified file
* can be read or not depending on the filename*/
template <typename T>

View File

@@ -561,6 +561,8 @@ UnitParticleSystem::UnitParticleSystem(int particleCount):
startTime = 0;
endTime = 1;
radiusBasedStartenergy = false;
}
UnitParticleSystem::~UnitParticleSystem(){

View File

@@ -192,6 +192,13 @@ CURL *SystemFlags::initHTTP() {
}
void SystemFlags::globalCleanupHTTP() {
if(curl_handle != NULL) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::cleanupHTTP(&curl_handle, true);
curl_handle = NULL;
}
if(SystemFlags::curl_global_init_called == true) {
SystemFlags::curl_global_init_called = false;
//printf("HTTP cleanup\n");
@@ -297,14 +304,7 @@ SystemFlags::~SystemFlags() {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(curl_handle != NULL) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::cleanupHTTP(&curl_handle, true);
curl_handle = NULL;
}
if(SystemFlags::curl_global_init_called == true) {
SystemFlags::globalCleanupHTTP();
}
SystemFlags::globalCleanupHTTP();
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}