bhhbazinga / BPlusTree

A simple persistent kv store based on B+Tree.
21 stars 4 forks source link

==214546==ERROR: LeakSanitizer: detected memory leaks #1

Closed Ravendocker closed 3 years ago

Ravendocker commented 3 years ago

There are some mistakes about memory leaks Direct leak of 358224 byte(s) in 7463 object(s) allocated from:

0 0x7fed88aa336f in operator new(unsigned long) (/lib64/libasan.so.5+0x10e36f)

#1 0x40fb8b in void BPlusTree::BlockCache::Put<BPlusTree::LeafNode>(BPlusTree::LeafNode*) /home/fenghw/storage/BPlusTree/bplus_tree.cc:283
#2 0x40d42b in void BPlusTree::UnMap<BPlusTree::LeafNode>(BPlusTree::LeafNode*) const /home/fenghw/storage/BPlusTree/bplus_tree.cc:515
#3 0x4058af in BPlusTree::Put(std::string const&, std::string const&) /home/fenghw/storage/BPlusTree/bplus_tree.cc:409
#4 0x402c33 in main /home/fenghw/storage/BPlusTree/test.cc:23
#5 0x7fed87dc9554 in __libc_start_main (/lib64/libc.so.6+0x22554)
bhhbazinga commented 3 years ago

@Ravendocker Thank you for reminding me. There is something wrong with the destructor of BlockCache. I have fixed it