Commit 12210543 authored by John Esmet's avatar John Esmet

fixes #116 Remove the 25% padding from toku_mempool_construct. Clean up

the bndata code that calls toku_mempool_construct.
parent 5b081b19
......@@ -114,8 +114,8 @@ void bn_data::initialize_from_data(uint32_t num_entries, unsigned char *buf, uin
}
KLPAIR *XMALLOC_N(num_entries, array); // create array of pointers to leafentries
unsigned char *newmem = NULL;
// add same wiggle room that toku_mempool_construct would, 25% extra
uint32_t allocated_bytes = data_size + data_size/4;
// add 25% extra wiggle room
uint32_t allocated_bytes = data_size + (data_size / 4);
CAST_FROM_VOIDP(newmem, toku_xmalloc(allocated_bytes));
unsigned char* curr_src_pos = buf;
unsigned char* curr_dest_pos = newmem;
......
......@@ -130,15 +130,13 @@ void toku_mempool_init(struct mempool *mp, void *base, size_t free_offset, size_
*/
void toku_mempool_construct(struct mempool *mp, size_t data_size) {
if (data_size) {
size_t mpsize = data_size + (data_size/4); // allow 1/4 room for expansion (would be wasted if read-only)
mp->base = toku_xmalloc(mpsize); // allocate buffer for mempool
mp->size = mpsize;
mp->free_offset = 0; // address of first available memory for new data
mp->frag_size = 0; // all allocated space is now in use
mp->base = toku_xmalloc(data_size);
mp->size = data_size;
mp->free_offset = 0;
mp->frag_size = 0;
}
else {
toku_mempool_zero(mp);
// fprintf(stderr, "Empty mempool created (base constructor)\n");
}
}
......
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