-
Notifications
You must be signed in to change notification settings - Fork 913
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
All hash tables should use tal #5868
All hash tables should use tal #5868
Conversation
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Since it gets resized during traverse, we would crash by keeping a pointer to the old one. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
902a0b8
to
fc74f69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid. I love how much simplification the htable_set_allocator
call brings to clean up. It's a shame the chan_arr
memory can't be recovered for nodes with hashtables, but I doubt it makes sense to optimize here (with many small nodes on the network.)
ACK fc74f69
*/ | ||
struct chan *chan_arr[6]; | ||
/* If we have more thn that, we use a hash. */ | ||
struct chan_map *chan_map; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the original chan array was sized according to the overhead of the htable - I suppose to make the union work out nicely. It looks like this is a net decrease of 1 (or maybe 2 depending on architecture) channels before transitioning to a hash table. Simpler to follow along now, and appreciate the documentation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fc74f69
We actually reduce the size of struct node by 1 pointer, which is mildly smaller. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want to change the htable allocator to use tal, which will need this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This makes them easier to clean up. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks C committee! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
fc74f69
to
410e94d
Compare
Added the typo fix that @vincenzopalazzo found! Ack 410e94d |
This would catch memory leaks like the one found by @whitslack in #5865 but requires us to allocate htable structs rather than embed them.
Changelog-None