Skip to content

-e option allocates memory aggressively #35

Description

@greymd

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions