Conversation
In #248 the possibile unlimited growth of the inner map map[libpf.AddressOrLineno]sourceInfo of the frames cache, was identified as potential issue. Replace this regular map with a LRU to limit its size. Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
Contributor
|
Should there be a regular call to |
christos68k
reviewed
Apr 25, 2025
| frameMap := frameMapLock.RLock() | ||
| defer frameMapLock.RUnlock(&frameMap) | ||
| _, known = (*frameMap)[frameID.AddressOrLine()] | ||
| _, known = (*frameMap).GetAndRefresh(frameID.AddressOrLine(), pdata.FrameMapLifetime) |
Member
There was a problem hiding this comment.
@rockdaboot Not for this PR but it seems clumsy to have to specify the lifetime every time GetAndRefresh is called if SetLifetime has been previously called to set one (if the lifetime we're specifying isn't different from the one we've previously set). Assuming that this is the common case, maybe we should optimize for it:
GetAndRefresh can use the LRU lifetime and a new method (e.g. GetAndRefreshWithLifetime) can be added to support custom per-value lifetimes.
Contributor
There was a problem hiding this comment.
It would be a breaking API change in go-freelru, but since we are 0.x, we can do this.
Created an issue: elastic/go-freelru#85
Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
rockdaboot
approved these changes
Apr 28, 2025
christos68k
approved these changes
Apr 28, 2025
This was referenced Jul 8, 2025
This was referenced Aug 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #248 the possibile unlimited growth of the inner map
map[libpf.AddressOrLineno]sourceInfoof theframescache, was identified as potential issue. Replace this regular map with a LRU to limit its size.