leveldb icon indicating copy to clipboard operation
leveldb copied to clipboard

Memory Leak?

Open QiAnXinCodeSafe opened this issue 1 year ago • 1 comments

Hi all, This is Qianxin CodeSafe Team, we found a memory leak, at https://github.com/google/leveldb/blob/23e35d792b9154f922b8b575b12596a4d8664c65/db/version_set.cc#L1240 https://github.com/google/leveldb/blob/23e35d792b9154f922b8b575b12596a4d8664c65/db/version_set.cc#L1241 Although the array is deleted at
https://github.com/google/leveldb/blob/23e35d792b9154f922b8b575b12596a4d8664c65/db/version_set.cc#L1248 , the elements in the array are not memory cleaned

QiAnXinCodeSafe avatar Oct 21 '24 08:10 QiAnXinCodeSafe

  • The ownership of objects created by Line 1240 NewTwoLevelIterator will be taken by NewMergingIterator

https://github.com/google/leveldb/blob/23e35d792b9154f922b8b575b12596a4d8664c65/db/version_set.cc#L1247-L1249

  • The ownership of objects created Liine 1241 new Version::LevelFileNumIterator(...) will be taken by the objects created by NewTwoLevelIterator

So no memory leaks!

likema avatar Jun 24 '25 18:06 likema