From c08684de2a6d9c5358fac5e93dc8a0081ce649b5 Mon Sep 17 00:00:00 2001 From: stippi Date: Fri, 12 Feb 2010 17:43:55 +0000 Subject: [PATCH] Removed no longer needed and supposedly non working LeakTracker. On top of this, WebCore already has it's own LeakTracker enabled in debug builds. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@52 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/LeakTracker.h | 119 ----------------------------- 1 file changed, 119 deletions(-) delete mode 100644 src/apps/webpositive/LeakTracker.h diff --git a/src/apps/webpositive/LeakTracker.h b/src/apps/webpositive/LeakTracker.h deleted file mode 100644 index c00b5d1cd8..0000000000 --- a/src/apps/webpositive/LeakTracker.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef LeakTracker_h -#define LeakTracker_h - -// This code is from: -// http://www.flipcode.com/archives/How_To_Find_Memory_Leaks.shtml -// I have modified it some. - -#ifndef NDEBUG - -#if __GNUC__ > 2 - #include - using namespace std; -#endif - -#include -#include - -typedef struct { - int address; - size_t size; - char file[64]; - int line; -} ALLOC_INFO; - -typedef vector AllocList; - -AllocList *allocList; - -void AddTrack(int addr, size_t asize, const char *fname, int lnum) -{ - ALLOC_INFO *info; - - if (!allocList) - allocList = new(AllocList); - - info = new(ALLOC_INFO); - info->address = addr; - strncpy(info->file, fname, 63); - info->line = lnum; - info->size = asize; - allocList->insert(allocList->begin(), info); -}; - -void RemoveTrack(int addr) -{ - AllocList::iterator i; - - if (!allocList) - return; - - for (i = allocList->begin(); i < allocList->end(); i++) { - if ((*i)->address == addr) { - allocList->erase(i); - break; - } - } -}; - -int unfreedCount() -{ - return allocList->size(); -} - -bool nothingUnfreed() -{ - return allocList->empty(); -} - -void OutputDebugString(char *str) -{ - printf(str); -} - -void DumpUnfreed() -{ - AllocList::iterator i; - int totalSize = 0; - char buf[1024]; - - if (!allocList) - return; - - for (i = allocList->begin(); i < allocList->end(); i++) { - sprintf(buf, "%-50s:\t\tLINE %d,\t\tADDRESS %d\t%d unfreed\n", - (*i)->file, (*i)->line, (*i)->address, (int)(*i)->size); - OutputDebugString(buf); - totalSize += (*i)->size; - } - sprintf(buf, "-----------------------------------------------------------\n"); - OutputDebugString(buf); - sprintf(buf, "Total Unfreed: %d bytes\n", totalSize); - OutputDebugString(buf); -}; - -inline void *operator new(size_t size, const char *file, int line) -{ - void *ptr = (void *)malloc(size); - AddTrack((int)ptr, size, file, line); - return(ptr); -}; - -inline void operator delete(void *p) throw() -{ - RemoveTrack((int)p); - free(p); -}; - -#define DEBUG_NEW new(__FILE__, __LINE__) - -#else -#define DEBUG_NEW new -#endif - - -#define new DEBUG_NEW - - -#endif // LeakTracker_h -