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

-e option allocates memory aggressively #35

Open
greymd opened this issue May 1, 2022 · 1 comment
Open

-e option allocates memory aggressively #35

greymd opened this issue May 1, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@greymd
Copy link
Owner

greymd commented May 1, 2022

See https://github.com/greymd/teip/wiki/Memory-Usage-Benchmark

-e requires approx 3 times as much memory as the standard input.
It can be reduced more.

Let me note my brief idea.
One of the reasons why it allocates large mount of memory is standard input is taken "hard copy" in _tee_thread.
https://github.com/greymd/teip/blob/v2.0.0/src/main.rs#L294-L349

Instead of hard copy of text, the text can be possessed in a linked list or a ring buffer.
If so, _tee_thread will not need to pass text through channel, instead, pass the index numbers of buffer.

Then, Main thread and _ex_thread may have to refer to the shared mutex object which indicates the latest index. All the data stored on the indexes smaller than the latest one would be released then.

@greymd greymd added enhancement New feature or request help wanted Extra attention is needed labels Mar 11, 2023
@greymd
Copy link
Owner Author

greymd commented Mar 11, 2023

Put help wante label.
Currently, I do not have enough resources to address this issue.
Any PRs are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant