Skip to content

grep_string or live_grep etc can lead to hang and excessive memory use for noobs. #1688

@1337cookie

Description

@1337cookie

I'm on Windows and I've installed Neovim and added Kickstart.nvim, rg, fd and the steps for telescope-fzf-native.
Life is good and It feels like there's nothing at all between me and my text documents. I even dreamt I was doing vim motions.
I'm playing around with all the new stuff with init.lua open and I do <leader>sw which is grep_string aka '[S]earch current [W]ord'. My cursor was on a { character so it starts churning through my whole home folder (1TB~ of files) looking for {. nvim.exe quickly starts becoming unresponsive as it's memory usage quickly grows to over 50gb at 97% of the system's memory usage. Watching in task manager eventually the disk usage on nvim.exe start to climb up as gigabytes of memory pages are written to disk. The same is true for <leader>sg aka '[S]earch by [G]rep' and typing. Within seconds of doing this nvim becomes unresponsive and needs to be forced closed.

Image

I'm not too sure how to introspect this behavior to see what exactly is the cause. Whether its the number of results, a very large file, binaries or w.h.y. I'm not sure. But I imagine its not unexpected that this could happen given the parameters like greping 1tb of files with no file type/file size like filters.

Would safeguarding against this kind of behavior by having default file size limits or file type filters for these searches make sense to be included in Kickstart.nvim somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions