Commit cae56019 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Get rid of memory leaks. Addresses #1000, #1080, #1131.

git-svn-id: file:///svn/tokudb.1131b+1080a@6158 c7de825b-a66e-492c-adef-691d508d4ae1
parent c126b01a
......@@ -192,3 +192,12 @@ block_allocator_block_size (BLOCK_ALLOCATOR ba, u_int64_t offset) {
assert(bn>=0); // we require that there is a block with that offset. Might as well abort if no such block exists.
return ba->blocks_array[bn].size;
}
u_int64_t
block_allocator_allocated_limit (BLOCK_ALLOCATOR ba) {
if (ba->n_blocks==0) return ba->reserve_at_beginning;
else {
struct blockpair *last = &ba->blocks_array[ba->n_blocks-1];
return last->offset + last->size;
}
}
......@@ -84,4 +84,12 @@ block_allocator_validate (BLOCK_ALLOCATOR ba);
void
block_allocator_print (BLOCK_ALLOCATOR ba);
u_int64_t
block_allocator_allocated_limit (BLOCK_ALLOCATOR ba);
// Effect: Return the unallocated block address of "infinite" size.
// That is, return the smallest address that is above all the allocated blocks.
// Rationale: When writing the root FIFO we don't know how big the block is.
// So we start at the "infinite" block, write the fifo, and then
// allocate_block_at of the correct size and offset to account for the root FIFO.
#endif
......@@ -211,6 +211,8 @@ void toku_brtheader_free (struct brt_header *h) {
toku_free(h->roots);
toku_free(h->root_hashes);
toku_free(h->flags_array);
toku_free(h->block_translation);
destroy_block_allocator(&h->block_allocator);
toku_free(h);
}
......
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