mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
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
This commit is contained in:
parent
c6f44bd826
commit
afcd389e52
3 changed files with 19 additions and 2 deletions
|
@ -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),)
|
||||
|
|
16
src/tests/test_forkjoin.c
Normal file
16
src/tests/test_forkjoin.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue