-
Notifications
You must be signed in to change notification settings - Fork 137
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
[Homework 5] Recursive drop #783
Comments
maybe related to the fact that growable_array test uses u32 for key, which is covered by depth 4 tree.
cs431/homework/doc/hash_table.md Lines 62 to 67 in 518270e
If stress_concurrent is the only test that fails, then you will get 20. Can you confirm that your solution passes the earlier tests? |
And how should I deal with trees of depth smaller than 4? |
What we can say is that your drop implementation is incorrect. What you should do in deallocating a segment is take ownership from the segment, (with That fact that your implementation does not pass when height is 1,2,3 suggests that the above process is not done correctly. |
I see. Thank you! |
The purpose of drop is to prevent memory leaks, so if you don't implement anything for drop and your get is correct, it should pass the tests, assuming memory does not run out. |
What if stress sequential fails because of invalid memory reference. Is it because of my drop implementation? |
Mabye? Your get may also not getting to the proper node. If you are getting invalid memory reference even without deallocation, your get is problematic. |
If I comment the drop function, I pass stress sequential, but in asan I get Memory Leak: running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.07s Testing split_ordered_list stress_sequential with cargo --release, timeout 10s... running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.07s Testing growable_array lookup_concurrent with cargo --release, timeout 10s... running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.24s Testing split_ordered_list lookup_concurrent with cargo --release, timeout 10s... running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.38s Testing growable_array insert_concurrent with cargo --release, timeout 10s... running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 2.36s Testing split_ordered_list insert_concurrent with cargo --release, timeout 10s... running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 6.56s Testing growable_array stress_concurrent with cargo --release, timeout 10s... running 1 test running 1 test running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.47s Test failed: cargo_asan test --test growable_array stress_sequential running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.50s Test failed: cargo_asan test --test split_ordered_list stress_sequential |
Do you mean that the depth node of some leaf node is not the same as the height of the tree? When |
yes. But what I understood is that to drop the segments of the growable_array (without the leafs) I have to drop all heights from root.tag to height = 1. |
That is correct. |
My main problem here is why recursive drop causes invalid memory reference in stress sequential, if i don't restrict the recursivity with: |
That would mean that you are doing drop incorrectly, and if there is the restriction you don't have a problem because we don't make tress of heights larger than 3. |
I see. Thank you! |
For drop() function of the growable_array, I used a recursive function to drop all segments until height = 1.
But the problem is My condition to continue the recursivity is height >=1. But that generates an Invalid Memory reference error
I tried different things and it seems that putting the condition to height >=4 works.
Why is that ?
I think that I keep failing stress_concurrent because of that.
And another question is, why is it that even if I fail only stress_concurrent I get 0 in total?
The text was updated successfully, but these errors were encountered: