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

try to malloc after a realloc failure. addresses #1328

git-svn-id: file:///svn/toku/tokudb.1032b@8404 c7de825b-a66e-492c-adef-691d508d4ae1
parent 59dcba62
......@@ -101,18 +101,21 @@ void memarena_move_buffers(MEMARENA dest, MEMARENA source) {
static int move_counter = 0;
move_counter++;
REALLOC_N(dest->n_other_bufs + source->n_other_bufs + 1, other_bufs);
if (other_bufs == 0) {
#if defined(_WIN32)
if (other_bufs == 0) {
char **new_other_bufs;
printf("_CrtCheckMemory:%d\n", _CrtCheckMemory());
#endif
printf("Z: move_counter:%d dest:%p %p %d source:%p %p %d errno:%d\n",
move_counter,
dest, dest->other_bufs, dest->n_other_bufs,
source, source->other_bufs, source->n_other_bufs,
errno);
printf("toku_memory_counters: %d %d %d\n", toku_malloc_counter, toku_realloc_counter, toku_free_counter);
assert(other_bufs);
new_other_bufs = toku_malloc((dest->n_other_bufs + source->n_other_bufs + 1)*sizeof (char **));
printf("new_other_bufs=%p errno=%d\n", new_other_bufs, errno);
}
#endif
assert(other_bufs);
dest->other_bufs = other_bufs;
for (i=0; i<source->n_other_bufs; i++) {
dest->other_bufs[dest->n_other_bufs++] = source->other_bufs[i];
......
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