- memory leak checker fixed a few issues

This commit is contained in:
Mark Vejvoda 2012-04-16 16:57:10 +00:00
parent 1403a3fe44
commit ae91368a99
2 changed files with 81 additions and 74 deletions

View File

@ -68,6 +68,7 @@ void exceptionMessage(const exception &excp) {
#if defined(__GNUC__) && !defined(__FreeBSD__) && !defined(BSD)
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
int line=-1;
if(PlatformExceptionHandler::application_binary != "") {
const int maxbufSize = 8094;
char buf[maxbufSize+1]="";
//char *p=NULL;
@ -151,6 +152,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
line = 0;
}
pclose(f);
}
return line;
}

View File

@ -14,7 +14,7 @@
using Shared::Platform::MutexSafeWrapper;
bool AllocInfo::application_binary_initialized = false;
static AllocRegistry memoryLeaks = AllocRegistry::getInstance();
//static AllocRegistry memoryLeaks = AllocRegistry::getInstance();
// =====================================================
// class AllocRegistry
@ -108,6 +108,11 @@ void AllocRegistry::dump(const char *path) {
fprintf(f, "Not monitored allocations: %d, %lu bytes\n", nonMonitoredCount, nonMonitoredBytes);
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