nvim-colorizer.lua icon indicating copy to clipboard operation
nvim-colorizer.lua copied to clipboard

Bug: ram usage spikes when scrolling

Open iaurman opened this issue 2 years ago • 2 comments

Describe the bug Neovim ram usage spikes when scrolling with Colorizer plugin loaded. This behavior disappears when Colorizer is not loaded.

To Reproduce

  1. Using neovim with nvim-colorizer.lua loaded to open a file
  2. Open another terminal running htop to monitor the ram usage of this neovim process. At this point it should be 20MB or so.
  3. On neovim, use your mouse to scroll
  4. You can see on htop that the ram goes up to about 200MB. If the file is long enough and you keep scrolling, it would go up to a few GBs easily and fast. Until it's got terminated by 00ram killer.

Expected behavior Not taking so much ram.

Operating System: Arch Linux x86_64

Neovim Version: NVIM v0.8.2

Colorizer Version: 760e27d 3 months ago

Config Content

require("colorizer").attach_to_buffer(0, { mode = "background", css = true})
require("colorizer").setup {
    filetypes = { "*" },
    user_default_options = {
        RGB = true, -- #RGB hex codes
        RRGGBB = true, -- #RRGGBB hex codes
        names = false, -- "Name" codes like Blue or blue
        RRGGBBAA = true, -- #RRGGBBAA hex codes
        AARRGGBB = true, -- 0xAARRGGBB hex codes
        rgb_fn = true, -- CSS rgb() and rgba() functions
        hsl_fn = true, -- CSS hsl() and hsla() functions
        css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
        css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
        -- Available modes for `mode`: foreground, background,  virtualtext
        mode = "background", -- Set the display mode.
        -- Available methods are false / true / "normal" / "lsp" / "both"
        -- True is same as normal
        tailwind = true, -- Enable tailwind colors
        virtualtext = "■",
    },
    -- all the sub-options of filetypes apply to buftypes
    buftypes = {},
}

iaurman avatar Jan 20 '23 15:01 iaurman

How big is this file ? I just scrolled through a 35k line file, it went to 90mb ( which is intented ), but nowhere near ooming

Akianonymus avatar Feb 25 '23 08:02 Akianonymus

https://user-images.githubusercontent.com/32216346/221348199-1415b202-0b9d-479b-9188-11b739d21575.mp4

Akianonymus avatar Feb 25 '23 08:02 Akianonymus