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

adjust searcher heap usage #11887

Open
mjkpolo opened this issue Oct 14, 2024 · 0 comments
Open

adjust searcher heap usage #11887

mjkpolo opened this issue Oct 14, 2024 · 0 comments
Labels
C-enhancement Category: Improvements

Comments

@mjkpolo
Copy link

mjkpolo commented Oct 14, 2024

It would be nice to change the max heap usage of the searcher in memory constrained environments like a cluster login node (which was killing helix when searching through large projects)

I posted this on the helix subreddit, and one of the commenters solved my issue and suggested I make a feature request. This is the patch that fixed my issue:

diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index f25e8254..ecfcacfc 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2327,6 +2327,7 @@ fn format(&self, current_path: &Self::Data) -> Row {

                 std::thread::spawn(move || {
                     let searcher = SearcherBuilder::new()
+                        .heap_limit(Some(5*1024*1024))
                         .binary_detection(BinaryDetection::quit(b'\x00'))
                         .build();

I have never written rust but if someone could point me in the general direction of how to add an options to the config.toml file and pass it to the searcher builder I would be be willing to try and add this as a feature.

@mjkpolo mjkpolo added the C-enhancement Category: Improvements label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant