Loading mysys/my_static.h +5 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,9 @@ struct irem { my_string _sFileName; /* File in which memory was new'ed */ uint _uLineNum; /* Line number in above file */ uint _uDataSize; /* Size requested */ #ifdef THREAD pthread_t thread_id; #endif long _lSpecialValue; /* Underrun marker value */ }; Loading @@ -57,11 +59,13 @@ extern const char *soundex_map; extern USED_MEM* my_once_root_block; extern uint my_once_extra; #ifdef THREAD /* These threads are exept from safemalloc leak scrutiny unless These threads are except from safemalloc leak scrutiny unless PEDANTIC_SAFEMALLOC is defined */ extern pthread_t signal_thread, kill_thread; #endif #ifndef HAVE_TEMPNAM extern int _my_tempnam_used; Loading mysys/safemalloc.c +22 −10 Original line number Diff line number Diff line Loading @@ -185,7 +185,9 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) pTmp -> sFileName = (my_string) sFile; pTmp -> uLineNum = uLine; pTmp -> uDataSize = uSize; #ifdef THREAD pTmp->thread_id = pthread_self(); #endif pTmp -> pPrev = NULL; /* Add this remember structure to the linked list */ Loading Loading @@ -371,12 +373,19 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile, return 0; } #ifdef THREAD static int legal_leak(struct remember* pPtr) { return pthread_self() == pPtr->thread_id || main_th == pPtr->thread_id || shutdown_th == pPtr->thread_id || signal_th == pPtr->thread_id; } #else static int legal_leak(struct remember* pPtr) { return 1; } #endif /* * TERMINATE(FILE *file) Loading @@ -390,12 +399,15 @@ void TERMINATE (FILE *file) DBUG_ENTER("TERMINATE"); pthread_mutex_lock(&THR_LOCK_malloc); /* Report the difference between number of calls to */ /* NEW and the number of calls to FREE. >0 means more */ /* NEWs than FREEs. <0, etc. */ /* Report the difference between number of calls to NEW and the number of calls to FREE. >0 means more NEWs than FREEs. <0, etc. */ #ifndef PEDANTIC_SAFEMALLOC /* Avoid false alarms for blocks that we cannot free before my_end() #if !defined(PEDANTIC_SAFEMALLOC) && defined(THREAD) /* Avoid false alarms for blocks that we cannot free before my_end() This does miss some positives, but that is ok. This will only miss failures to free things allocated in the main thread which performs only one-time allocations. If you really need to Loading Loading
mysys/my_static.h +5 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,9 @@ struct irem { my_string _sFileName; /* File in which memory was new'ed */ uint _uLineNum; /* Line number in above file */ uint _uDataSize; /* Size requested */ #ifdef THREAD pthread_t thread_id; #endif long _lSpecialValue; /* Underrun marker value */ }; Loading @@ -57,11 +59,13 @@ extern const char *soundex_map; extern USED_MEM* my_once_root_block; extern uint my_once_extra; #ifdef THREAD /* These threads are exept from safemalloc leak scrutiny unless These threads are except from safemalloc leak scrutiny unless PEDANTIC_SAFEMALLOC is defined */ extern pthread_t signal_thread, kill_thread; #endif #ifndef HAVE_TEMPNAM extern int _my_tempnam_used; Loading
mysys/safemalloc.c +22 −10 Original line number Diff line number Diff line Loading @@ -185,7 +185,9 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) pTmp -> sFileName = (my_string) sFile; pTmp -> uLineNum = uLine; pTmp -> uDataSize = uSize; #ifdef THREAD pTmp->thread_id = pthread_self(); #endif pTmp -> pPrev = NULL; /* Add this remember structure to the linked list */ Loading Loading @@ -371,12 +373,19 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile, return 0; } #ifdef THREAD static int legal_leak(struct remember* pPtr) { return pthread_self() == pPtr->thread_id || main_th == pPtr->thread_id || shutdown_th == pPtr->thread_id || signal_th == pPtr->thread_id; } #else static int legal_leak(struct remember* pPtr) { return 1; } #endif /* * TERMINATE(FILE *file) Loading @@ -390,12 +399,15 @@ void TERMINATE (FILE *file) DBUG_ENTER("TERMINATE"); pthread_mutex_lock(&THR_LOCK_malloc); /* Report the difference between number of calls to */ /* NEW and the number of calls to FREE. >0 means more */ /* NEWs than FREEs. <0, etc. */ /* Report the difference between number of calls to NEW and the number of calls to FREE. >0 means more NEWs than FREEs. <0, etc. */ #ifndef PEDANTIC_SAFEMALLOC /* Avoid false alarms for blocks that we cannot free before my_end() #if !defined(PEDANTIC_SAFEMALLOC) && defined(THREAD) /* Avoid false alarms for blocks that we cannot free before my_end() This does miss some positives, but that is ok. This will only miss failures to free things allocated in the main thread which performs only one-time allocations. If you really need to Loading