Fix sstable defragment memory leak
This commit is contained in:
@ -383,8 +383,7 @@ int ObSharedMacroBlockMgr::defragment()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArenaAllocator task_allocator("SSTDefragTask", OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||
const lib::ObMemAttr mem_attr(MTL_ID(), "SSTDefragIter");
|
||||
ObFIFOAllocator iter_allocator;
|
||||
ObArenaAllocator iter_allocator("SSTDefragIter", OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||
ObFixedArray<MacroBlockId, ObIAllocator> macro_ids(task_allocator);
|
||||
ObTenantTabletIterator tablet_iter(*(MTL(ObTenantMetaMemMgr*)), iter_allocator);
|
||||
ObSSTableIndexBuilder *sstable_index_builder = nullptr;
|
||||
@ -394,9 +393,6 @@ int ObSharedMacroBlockMgr::defragment()
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSharedMacroBlockMgr hasn't been initiated", K(ret));
|
||||
} else if (OB_FAIL(iter_allocator.init(lib::ObMallocAllocator::get_instance(),
|
||||
OB_MALLOC_NORMAL_BLOCK_SIZE, mem_attr))) {
|
||||
STORAGE_LOG(WARN, "fail to init fifo allocator", K(ret));
|
||||
} else if (OB_FAIL(macro_ids.init(MAX_RECYCLABLE_BLOCK_CNT))) {
|
||||
LOG_WARN("fail to init macro ids", K(ret));
|
||||
} else if (OB_FAIL(get_recyclable_blocks(task_allocator, macro_ids))) {
|
||||
@ -408,6 +404,8 @@ int ObSharedMacroBlockMgr::defragment()
|
||||
} else {
|
||||
ObTabletHandle tablet_handle;
|
||||
while (OB_SUCC(ret)) {
|
||||
tablet_handle.reset();
|
||||
iter_allocator.reuse();
|
||||
if (OB_FAIL(tablet_iter.get_next_tablet(tablet_handle))) {
|
||||
LOG_WARN("fail to get tablet", K(ret), K(tablet_handle));
|
||||
} else if (OB_UNLIKELY(!tablet_handle.is_valid())) {
|
||||
|
Reference in New Issue
Block a user