Commit 2d351ec3 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

mixing toku_malloc and malloc is not a problem. At least with BUFFERED_MALLOC...

mixing toku_malloc and malloc is not a problem.  At least with BUFFERED_MALLOC not defined.  Added a test, and a {{{#error}}} inside {{{memory.c}}}.  Fixes #161.

git-svn-id: file:///svn/tokudb@1026 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6e9a2579
...@@ -43,6 +43,7 @@ BINS = $(REGRESSION_TESTS) \ ...@@ -43,6 +43,7 @@ BINS = $(REGRESSION_TESTS) \
randbrt \ randbrt \
randdb4 \ randdb4 \
tdb_logprint \ tdb_logprint \
test_toku_malloc_plain_free \
# This line intentially kept commented so I can have a \ on the end of the previous line # This line intentially kept commented so I can have a \ on the end of the previous line
tdb_logprint: LDFLAGS+=-lz tdb_logprint: LDFLAGS+=-lz
...@@ -68,6 +69,7 @@ check: bins ...@@ -68,6 +69,7 @@ check: bins
$(DTOOL) ./brt-serialize-test $(DTOOL) ./brt-serialize-test
$(DTOOL) ./brt-test $(DTOOL) ./brt-test
$(DTOOL) ./hashtest $(DTOOL) ./hashtest
$(DTOOL) ./test_toku_malloc_plain_free
./benchmark-test --valsize 256 --verify 1 ./benchmark-test --valsize 256 --verify 1
check-fanout: check-fanout:
...@@ -106,7 +108,7 @@ brt-verify.o: $(BRT_INTERNAL_H_INCLUDES) ...@@ -106,7 +108,7 @@ brt-verify.o: $(BRT_INTERNAL_H_INCLUDES)
fingerprint.o: $(BRT_INTERNAL_H_INCLUDES) fingerprint.o: $(BRT_INTERNAL_H_INCLUDES)
brt-serialize-test: brt-serialize-test.o brt-serialize.o memory.o hashtable.o pma.o key.o ybt.o brt.o cachetable.o primes.o log.o mempool.o brt-verify.o fingerprint.o log_code.o brt-serialize-test: brt-serialize-test.o brt-serialize.o memory.o hashtable.o pma.o key.o ybt.o brt.o cachetable.o primes.o log.o mempool.o brt-verify.o fingerprint.o log_code.o
test_toku_malloc_plain_free: memory.o
cachetable-test.o: cachetable.h memory.h cachetable-test.o: cachetable.h memory.h
......
...@@ -58,6 +58,8 @@ static void note_did_free(void *p) { ...@@ -58,6 +58,8 @@ static void note_did_free(void *p) {
//#define BUFFERED_MALLOC //#define BUFFERED_MALLOC
#ifdef BUFFERED_MALLOC #ifdef BUFFERED_MALLOC
#error "Turning on BUFFERED_MALLOC will probably break things. For example, DBT's are DB_DBT_MALLOC'd using toku_malloc(), but then the user calls free() (rather than toku_free)."
enum { BUFFERING = 4096 }; enum { BUFFERING = 4096 };
void mark_buffer (char *p, int size) { void mark_buffer (char *p, int size) {
unsigned int *pl = (unsigned int*)p; unsigned int *pl = (unsigned int*)p;
......
#include "memory.h"
#include "stdlib.h"
int main () {
char *m=toku_malloc(5);
m=m;
free(m);
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