Commit b917089d authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

test_thread_insert doesn't leak memory any more. The leak is in...

test_thread_insert doesn't leak memory any more.  The leak is in {{{pthread_exit()}}}.  If you return from the initial function, the leak isn't there.  Fixes #303.

git-svn-id: file:///svn/tokudb@2884 c7de825b-a66e-492c-adef-691d508d4ae1
parent 232328dd
......@@ -30,7 +30,7 @@ else
endif
BDB_LDFLAGS += -lpthread
TDB_LOADLIBES = -L.. -ltokudb -Wl,-rpath,.. -lpthread
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=yes
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=full --show-reachable=yes
HGRIND=valgrind --quiet --tool=helgrind
endif
ifeq ($(VGRIND),)
......
#include <stdio.h>
#include <assert.h>
#include <pthread.h>
void *f(void *arg) {
//pthread_exit(arg); // pthread_exit has a memoryh leak.
return arg;
}
int main() {
pthread_t t;
int r = pthread_create(&t, 0, f, 0); assert(r == 0);
void *ret;
r = pthread_join(t, &ret); assert(r == 0);
return 0;
}
......@@ -46,7 +46,8 @@ void *do_inserts(void *arg) {
}
if (verbose) printf("%lu:%u:do_inserts:end\n", (unsigned long)pthread_self(), getmyid());
if (mywork->do_exit) pthread_exit(arg);
// Don't call pthread_exit(), since it has a memory leak.
// if (mywork->do_exit) pthread_exit(arg);
return 0;
}
......
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