mirror of https://github.com/Jittor/Jittor
Merge pull request #509 from uyzhang/master
Fix memory leak in TempAllocator::free()
This commit is contained in:
commit
80004c2928
|
@ -81,6 +81,10 @@ void TempAllocator::free(void* mem_ptr, size_t size, const size_t& allocation) {
|
|||
auto it = cached_blocks.lower_bound(get_key(block));
|
||||
if (it == cached_blocks.begin()) {
|
||||
can_add = false;
|
||||
underlying->free((void*)block->memory_ptr, block->size, 0);
|
||||
unused_memory -= block->size;
|
||||
block_ids.push_back(block->id);
|
||||
delete block;
|
||||
} else {
|
||||
--it;
|
||||
TempCachingBlock* block = it->second;
|
||||
|
|
Loading…
Reference in New Issue