mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 11:24:00 +02:00
- memory leak checker fixed a few issues
This commit is contained in:
@@ -68,6 +68,7 @@ void exceptionMessage(const exception &excp) {
|
|||||||
#if defined(__GNUC__) && !defined(__FreeBSD__) && !defined(BSD)
|
#if defined(__GNUC__) && !defined(__FreeBSD__) && !defined(BSD)
|
||||||
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
|
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
|
||||||
int line=-1;
|
int line=-1;
|
||||||
|
if(PlatformExceptionHandler::application_binary != "") {
|
||||||
const int maxbufSize = 8094;
|
const int maxbufSize = 8094;
|
||||||
char buf[maxbufSize+1]="";
|
char buf[maxbufSize+1]="";
|
||||||
//char *p=NULL;
|
//char *p=NULL;
|
||||||
@@ -151,6 +152,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
|
|||||||
line = 0;
|
line = 0;
|
||||||
}
|
}
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
using Shared::Platform::MutexSafeWrapper;
|
using Shared::Platform::MutexSafeWrapper;
|
||||||
|
|
||||||
bool AllocInfo::application_binary_initialized = false;
|
bool AllocInfo::application_binary_initialized = false;
|
||||||
static AllocRegistry memoryLeaks = AllocRegistry::getInstance();
|
//static AllocRegistry memoryLeaks = AllocRegistry::getInstance();
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class AllocRegistry
|
// class AllocRegistry
|
||||||
@@ -108,6 +108,11 @@ void AllocRegistry::dump(const char *path) {
|
|||||||
fprintf(f, "Not monitored allocations: %d, %lu bytes\n", nonMonitoredCount, nonMonitoredBytes);
|
fprintf(f, "Not monitored allocations: %d, %lu bytes\n", nonMonitoredCount, nonMonitoredBytes);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
printf("Memory leak dump summary:\n");
|
||||||
|
printf("Total leaks: %d, %lu bytes\n", leakCount, leakBytes);
|
||||||
|
printf("Total allocations: %d, %lu bytes\n", allocCount, allocBytes);
|
||||||
|
printf("Not monitored allocations: %d, %lu bytes\n", nonMonitoredCount, nonMonitoredBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user