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

Support padding for the leaves of the merkle tree #647

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

mickeyasa
Copy link
Contributor

Support padding for the leaves of the merkle tree

Copy link
Contributor Author

@mickeyasa mickeyasa left a comment

Choose a reason for hiding this comment

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

Support padding for the leaves of the merkle tree

mickeyasa and others added 9 commits November 6, 2024 16:28
… cuda always has zeros in some parts

Signed-off-by: Koren-Brand <[email protected]>
…ed) and some additional memory leaks in Merkle tree cpu backend as well as the hash tests

Signed-off-by: Koren-Brand <[email protected]>
Signed-off-by: Koren-Brand <[email protected]>
… the same test to cpp test_hash_api)

Signed-off-by: Koren-Brand <[email protected]>
…ents weren't randomized properly

Signed-off-by: Koren-Brand <[email protected]>
Signed-off-by: Koren-Brand <[email protected]>
~CPUMerkleTreeBackend()
{
for (auto& pair : m_map_segment_id_2_inputs) {
delete pair.second; // Ensure all dynamically allocated memory is freed
Copy link
Collaborator

Choose a reason for hiding this comment

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

modern C++ should avoid new/malloc+delete/free and use smart pointers anyway. This would avoid the leak and also works when exceptions are thrown.
There is usually no reason to use malloc/new

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

m_map_segment_id_2_inputs.erase(completed_segment_id);
auto segment = m_map_segment_id_2_inputs.find(completed_segment_id);
if (segment != m_map_segment_id_2_inputs.end()) {
delete segment->second;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment here. With smart pointers you only need to erase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

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.

3 participants