Commit b9a7c166 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

close[t:4671] Annotate every malloc with {{{ANNOTATE_NEW_MEMORY()}}} and get...

close[t:4671] Annotate every malloc with {{{ANNOTATE_NEW_MEMORY()}}} and get rid of the {{{--check-stack-var-yes}}}.  This fixes for valgrind 3.7.0 but not for valgrind 3.6.1.  Closes #4671.

git-svn-id: file:///svn/toku/tokudb@41430 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7cabbcf6
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <valgrind/helgrind.h>
#include "memory.h" #include "memory.h"
#include "toku_assert.h" #include "toku_assert.h"
...@@ -108,6 +109,7 @@ void * ...@@ -108,6 +109,7 @@ void *
toku_malloc(size_t size) { toku_malloc(size_t size) {
void *p = t_malloc ? t_malloc(size) : os_malloc(size); void *p = t_malloc ? t_malloc(size) : os_malloc(size);
if (p) { if (p) {
ANNOTATE_NEW_MEMORY(p, size);
if (toku_memory_do_stats) { if (toku_memory_do_stats) {
size_t used = my_malloc_usable_size(p); size_t used = my_malloc_usable_size(p);
__sync_add_and_fetch(&status.malloc_count, 1); __sync_add_and_fetch(&status.malloc_count, 1);
...@@ -118,7 +120,7 @@ toku_malloc(size_t size) { ...@@ -118,7 +120,7 @@ toku_malloc(size_t size) {
} else { } else {
__sync_add_and_fetch(&status.malloc_fail, 1); __sync_add_and_fetch(&status.malloc_fail, 1);
} }
return p; return p;
} }
void * void *
...@@ -185,6 +187,7 @@ toku_xmalloc(size_t size) { ...@@ -185,6 +187,7 @@ toku_xmalloc(size_t size) {
void *p = t_xmalloc ? t_xmalloc(size) : os_malloc(size); void *p = t_xmalloc ? t_xmalloc(size) : os_malloc(size);
if (p == NULL) // avoid function call in common case if (p == NULL) // avoid function call in common case
resource_assert(p); resource_assert(p);
ANNOTATE_NEW_MEMORY(p, size);
if (toku_memory_do_stats) { if (toku_memory_do_stats) {
size_t used = my_malloc_usable_size(p); size_t used = my_malloc_usable_size(p);
__sync_add_and_fetch(&status.malloc_count, 1); __sync_add_and_fetch(&status.malloc_count, 1);
......
...@@ -1057,7 +1057,7 @@ tiny_%.drdrun: %.tdb ...@@ -1057,7 +1057,7 @@ tiny_%.drdrun: %.tdb
$(MAYBEINVERTER) $(SUMMARIZE_CMD) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
mid_%.drdrun: %.tdb mid_%.drdrun: %.tdb
./$< --only_create --envdir dir.$@ --num_elements 10000 && \ ./$< --only_create --envdir dir.$@ --num_elements 10000 && \
$(VALGRIND) --tool=drd --quiet --check-stack-var=yes --suppressions=drd.suppressions --error-exitcode=1 ./$< $(VERBVERBOSE) --only_stress --num_seconds 100 --envdir dir.$@ --num_elements 10000 \ $(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions --error-exitcode=1 ./$< $(VERBVERBOSE) --only_stress --num_seconds 100 --envdir dir.$@ --num_elements 10000 \
$(MAYBEINVERTER) $(SUMMARIZE_CMD) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
large_%.drdrun: %.tdb large_%.drdrun: %.tdb
./$< --only_create --envdir dir.$@ && \ ./$< --only_create --envdir dir.$@ && \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment