You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a bug in the implementation of SkipMap leading to memory leaks. I found this while investigating #11 which refers to a different area though.
Instrumenting the Drop implementation:
implDropforNode{fndrop(&mutself){// large object should dropifletSome(mut next) = self.next.take(){println!("destroyed {:?}", next.key);whileletSome(child) = next.next.take(){
next = child;println!("destroyed {:?}", next.key);}}println!("destroyed {:?}",self.key);unsafe{for skip inself.skips.iter_mut(){ifletSome(mut next) = skip.take(){whileletSome(child) = (*next).next.take(){
next = Box::into_raw(child);}}}}}}
gives
running 1 test
destroyed [97, 98, 97]
destroyed [97, 98, 97]
destroyed [97, 98, 98]
destroyed [97, 98, 98]
destroyed []
test skipmap::tests::test_skipmap_iterator_init ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 142 filtered out; finished in 0.00s
for a skipmap constructed as
pubfnmake_skipmap() -> SkipMap{letmut skm = SkipMap::new(options::for_test().cmp);let keys = vec!["aba","abb","abc","abd","abe","abf","abg","abh","abi","abj","abk","abl","abm","abn","abo","abp","abq","abr","abs","abt","abu","abv","abw","abx","aby","abz",];for k in keys {
skm.insert(k.as_bytes().to_vec(),"def".as_bytes().to_vec());}
skm
}
The text was updated successfully, but these errors were encountered:
There seems to be a bug in the implementation of
SkipMap
leading to memory leaks. I found this while investigating #11 which refers to a different area though.Instrumenting the
Drop
implementation:gives
for a skipmap constructed as
The text was updated successfully, but these errors were encountered: