Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ Run `:FFFScan` to force a rescan.
- `:FFFOpenLog` opens the current session's log file.
- Historical log files are stored near the main log file `<state>/log/fff+<UTC-timestamp>+<pid>.log` (up to 20 files)
- For a crash backtrace, run `lldb -- nvim` or `gdb -- nvim` and reproduce
- fff keeps its allocator off transparent huge pages to keep the index RSS low (~15-20% on large repos); set `MIMALLOC_ALLOW_LARGE_OS_PAGES=2` before starting Neovim to trade that memory back for a slightly faster initial index build

</details>

Expand Down
15 changes: 15 additions & 0 deletions crates/fff-core/src/file_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,21 @@ fn common_dir_prefix_len(a: &str, b: &str) -> usize {
last_sep
}

/// Keep mimalloc off 2 MiB huge pages: with THP the arena is resident at
/// 2 MiB granularity and idle index memory inflates RSS by ~2x. Env overrides win.
/// Must run before the first allocation (see `fff_nvim`'s init-array hook).
#[cfg(feature = "mimalloc-collect")]
pub extern "C" fn tune_mimalloc() {
// SAFETY: getenv/mi_option_set touch static tables only; no allocation happens here.
unsafe {
let user_set = !libc::getenv(c"MIMALLOC_ALLOW_LARGE_OS_PAGES".as_ptr()).is_null()
|| !libc::getenv(c"MIMALLOC_LARGE_OS_PAGES".as_ptr()).is_null();
if !user_set {
libmimalloc_sys::mi_option_set(libmimalloc_sys::mi_option_large_os_pages, 0);
}
}
}

/// Ask the global allocator to return freed pages to the OS.
/// Enabled via the `mimalloc-collect` feature (set by fff-nvim).
/// No-op when the feature is off (tests, system allocator).
Expand Down
Loading
Loading