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

Free memory on request finish #240

Merged
merged 5 commits into from
Oct 7, 2021
Merged

Conversation

hannahhoward
Copy link
Collaborator

Goals

fix #236
Our issue here is with the request side allocation -- we aren't freeing memory properly when requests terminate early.

Implementation

  • track how much memory is freed when a request finishes
  • deallocate it

@@ -43,14 +43,20 @@ func New(unverifiedBlockStore UnverifiedBlockStore) *ResponseCache {

// FinishRequest indicate there is no more need to track blocks tied to this
// response
func (rc *ResponseCache) FinishRequest(requestID graphsync.RequestID) {
func (rc *ResponseCache) FinishRequest(requestID graphsync.RequestID) uint64 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

add comment indicating this return value is the total length of data over the blocks that have been pruned? (if i'm reading that right)

@hannahhoward hannahhoward merged commit e389abd into main Oct 7, 2021
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
@mvdan mvdan deleted the feat/cleanup-allocations branch December 15, 2021 14:18
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.

Graphsync freezes because memory is not freed on the allocator
2 participants