Commit f5d9cb9f authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

add some debugging code. addresses #1328

git-svn-id: file:///svn/toku/tokudb.1032b@8371 c7de825b-a66e-492c-adef-691d508d4ae1
parent dfed432b
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
#include "includes.h" #include "includes.h"
// execute the cachetable callbacks using a writer thread 0->no 1->yes // execute the cachetable callbacks using a writer thread 0->no 1->yes
#if defined(_WIN32)
#define DO_WRITER_THREAD 0
#else
#define DO_WRITER_THREAD 1 #define DO_WRITER_THREAD 1
#endif
#if DO_WRITER_THREAD #if DO_WRITER_THREAD
static void *cachetable_writer(void *); static void *cachetable_writer(void *);
#endif #endif
......
...@@ -90,21 +90,28 @@ void memarena_close(MEMARENA *map) { ...@@ -90,21 +90,28 @@ void memarena_close(MEMARENA *map) {
*map = 0; *map = 0;
} }
#if defined(_WIN32)
#include <windows.h>
#include <crtdbg.h>
#endif
void memarena_move_buffers(MEMARENA dest, MEMARENA source) { void memarena_move_buffers(MEMARENA dest, MEMARENA source) {
int i; int i;
char **other_bufs = dest->other_bufs; char **other_bufs = dest->other_bufs;
static int counter = 0; static int move_counter = 0;
counter++; move_counter++;
REALLOC_N(dest->n_other_bufs + source->n_other_bufs + 1, other_bufs); REALLOC_N(dest->n_other_bufs + source->n_other_bufs + 1, other_bufs);
if (other_bufs == 0) { if (other_bufs == 0) {
extern int toku_malloc_counter, toku_realloc_counter, toku_free_counter;
#if defined(_WIN32) #if defined(_WIN32)
extern int _CrtCheckMemory(void); printf("_CrtCheckMemory:%d\n", _CrtCheckMemory());
#endif #endif
printf("Z: counter:%d dest:%p %p %d source:%p %p %d errno:%d\n", printf("Z: move_counter:%d dest:%p %p %d source:%p %p %d errno:%d\n",
counter, move_counter,
dest, dest->other_bufs, dest->n_other_bufs, dest, dest->other_bufs, dest->n_other_bufs,
source, source->other_bufs, source->n_other_bufs, source, source->other_bufs, source->n_other_bufs,
errno); errno);
printf("toku_memory_counters: %d %d %d\n", toku_malloc_counter, toku_realloc_counter, toku_free_counter);
assert(other_bufs); assert(other_bufs);
} }
dest->other_bufs = other_bufs; dest->other_bufs = other_bufs;
......
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