Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix btree destructors #2127 #2287

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

julienhenry
Copy link
Member

@julienhenry julienhenry commented Jun 17, 2022

Fixing destructor issues on the Btree datastructures.
Related to #2130 #2127

@julienhenry julienhenry changed the title fix btree destructors fix btree destructors #2127 Jun 17, 2022
@codecov
Copy link

codecov bot commented Jun 17, 2022

Codecov Report

Merging #2287 (8f30dd5) into master (89c831c) will increase coverage by 0.00%.
The diff coverage is 11.11%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2287   +/-   ##
=======================================
  Coverage   77.41%   77.42%           
=======================================
  Files         461      461           
  Lines       28996    29003    +7     
=======================================
+ Hits        22447    22455    +8     
+ Misses       6549     6548    -1     
Impacted Files Coverage Δ
src/include/souffle/datastructure/BTreeDelete.h 56.85% <11.11%> (-0.59%) ⬇️
src/include/souffle/datastructure/BTree.h 98.31% <0.00%> (+0.42%) ⬆️
src/include/souffle/utility/ParallelUtil.h 85.27% <0.00%> (+0.77%) ⬆️
src/include/souffle/datastructure/UnionFind.h 97.80% <0.00%> (+2.19%) ⬆️
src/include/souffle/datastructure/LambdaBTree.h 75.57% <0.00%> (+2.29%) ⬆️

@b-scholz
Copy link
Member

Unfortunately, a VTABLE (introducing a virtual destructor for class node) will slow us down - specifically for clearing memory. We would need some static means to fix this. We would need something like this:
https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern

@julienhenry
Copy link
Member Author

Here is another attempt. Before calling delete, we check if this is an inner node or leaf node. If this is an inner node, make sure to reset its children to make sure they do not get deleted.

Copy link
Member

@b-scholz b-scholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants