Skip to content

Conversation

@demosdemon
Copy link
Contributor

@demosdemon demosdemon commented Aug 29, 2025

Why this should be merged

Previously, when the database is closing, coreth would not free the memory used by the proposals in firewood. This is relying on an internal implementation detail of firewood but it is a violation of the firewood API contract. In the future, this will lead to memory leaks.

The Go garbage collector will be unable to free this memory because it is not owned by Go but instead the C/Rust layer.

How this works

This change reuses the dereference method and calls it for all cached proposals.

How this was tested

Existing integration tests cover this path well.

Need to be documented?

No

Need to update RELEASES.md?

Problem: Previously, when the database is closing, coreth would not free
the memory used by the proposals in firewood. This is relying on an
internal implementation detail of firewood but it is a violation of the
firewood API contract. In the [future], this will lead to memory leaks.

Solution: This change adds a method to the ProposalContext that the db
uses to recursively free the proposal but skip the proposal map removal
as it is redundant when closing the database.

[future]: ava-labs/firewood#1221
@demosdemon demosdemon requested review from a team and alarso16 as code owners August 29, 2025 16:45
@demosdemon demosdemon marked this pull request as draft August 29, 2025 16:53
@demosdemon demosdemon marked this pull request as ready for review August 29, 2025 17:09
@demosdemon demosdemon requested a review from alarso16 September 5, 2025 14:42
@StephenButtolph StephenButtolph added this pull request to the merge queue Sep 15, 2025
Merged via the queue into master with commit 224d7c9 Sep 15, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants