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

fix(proctree): limit tree memory usage and reduce it #4058

Merged

Conversation

AlonZivony
Copy link
Contributor

1. Explain what the PR does

This PR add limitation on the changelog objects sizes, and reduces drastically the memory usage of the tree by not saving the interpreter and interp information in the tree.
This should reduce the chance for memory leakage.
By rough calculation, before the PR the process tree would take around 150MB of memory on average.
After this change, it should be reduced by at least 60MB on average.

2. Explain how to test it

3. Other comments

Add limitation to the amount of logged objects in the changelog.
This should help in reducing the chance of memory leakage.
The current proces tree takes a lot of memory (~150MB from calculation).
However, it is a new feature and not all of its info has high chance to
be used.
For now, it was decided to not save the interpreter and interp
information for processes until it was proven to be needed.
This should reduce the process tree size by at least 60MB (but will
probably reduce more than that).
File paths are created by concatting the dentries names from the root to the file, and concattign the file name in the end.
Although each dentry and file name has max length, the entire path has none.
To avoid memorly leakage caused by saving file paths, introduce a limit to the save path length.
@AlonZivony AlonZivony force-pushed the feature/bounded-memory-changelog branch from 41ce163 to 03d6822 Compare May 19, 2024 14:04
Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

LGTM

@yanivagman yanivagman merged commit fd72855 into aquasecurity:main May 20, 2024
32 checks passed
@AlonZivony AlonZivony deleted the feature/bounded-memory-changelog branch May 21, 2024 10:40
@AlonZivony AlonZivony restored the feature/bounded-memory-changelog branch June 13, 2024 12:56
@geyslan geyslan mentioned this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants