Fix memory leak #94
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
Epic
good first issue
hacktoberfest
hard fork
help wanted
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
soft fork
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
work in progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbrycrd#94
Loading…
Reference in a new issue
No description provided.
Delete branch "fix_memory_leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
b2ba3f5
There was a memory leak which would cause a extra ClaimTrie node to be allocated but never deleted.
This would happen when a new node would be created in the ClaimTrie and CClaimTrieCache.addNodeToCache() was called.
The only reason the extra ClaimTrie node was created was to serve as a empty node template which would be copied by value over to the actual Node (I guess it looks like a DRY shortcut that was not implemented correctly). This is not necessary, and the fix just creates an empty node when necessary.
a2fa2c0
the was a missing clear() on a cache object in CClaimTrieCache. This should not cause any problem since we don't need to call clear() on map objects that are going to get destroyed anyways but nonetheless should be consistent.
Was able to reindex with this patch, and passes tests. Uses half the memory it used to according to my tests.
Steve has told me that he has reviewed the fix and tested it. So should be merging this.
I have checked this under a heap checker and it fixes the leak of the CClaimTrieNode called "original" in this function.