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

live_grep results are not removed by a garbage collector #2370

Closed
dembitskyi opened this issue Feb 8, 2023 · 3 comments
Closed

live_grep results are not removed by a garbage collector #2370

dembitskyi opened this issue Feb 8, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@dembitskyi
Copy link

Description

Neovim does not release live_grep results memory.
An activity monitor (e.g. htop) shows that nvim keeps 'live_grep' results forever. Sometimes it releases 50%, but it never goes to 5%. This makes the telescope plugin unusable if you need to work with a project that has a codebase like android or bigger.

I tried invoking lua collectgarbage("collect") multiple times, but it did not help.

Neovim version

NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Pop!_OS 22.04 LTS

Telescope version / branch / rev

203bf56

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - WARNING: nvim-treesitter not found. 

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.3.1

## ===== Installed extensions =====

Steps to reproduce

  1. cd $HOME/android
  2. nvim -nu /tmp/minimal.lua
  3. Telescope live_grep
    3.1. type "l" and wait 5 minutes
    3.2. close the live_grep window
  4. Open Telescope planets and close it - this should release cached pickers
  5. repeat "3 - 4 steps" 5 times
  6. lua collectgarbage("collect")
  7. check nvim memory usage

Expected behavior

Nvim uses ~1GB of RAM or less.

Actual behavior

Nvim will consume 50GB of RAM after just 10 live_grep attempts :(
Recovery: reopen nvim

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
@dembitskyi dembitskyi added the bug Something isn't working label Feb 8, 2023
@SonTrinhEH
Copy link

SonTrinhEH commented Apr 12, 2023

I currently face the same issue, I'm not able to do the live grep to search things in my project

@jamestrew
Copy link
Contributor

I've tried to replicate this with the linux source code, but I don't see a significant increase in memory usage over time.

Nvim uses ~1GB of RAM or less.

This is pretty much my experience.
This is on arch linux, nightly neovim and telescope.

@jamestrew
Copy link
Contributor

Try this out: #2482 (comment)
I think this issue is relate to changes in the default vimgrep args.
I've created a PR for this already #2488

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants