Skip to main content
Module

x/denops_std/function/mod.ts>garbagecollect

📚 Standard module for denops.vim
Go to Latest
function garbagecollect
import { garbagecollect } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Cleanup unused Lists, Dictionaries, Channels and Jobs that have circular references.

There is hardly ever a need to invoke this function, as it is automatically done when Vim runs out of memory or is waiting for the user to press a key after 'updatetime'. Items without circular references are always freed when they become unused. This is useful if you have deleted a very big List and/or Dictionary with circular references in a script that runs for a long time.

When the optional {atexit} argument is one, garbage collection will also be done when exiting Vim, if it wasn't done before. This is useful when checking for memory leaks.

The garbage collection is not done immediately but only when it's safe to perform. This is when waiting for the user to type a character. To force garbage collection immediately use test_garbagecollect_now().

Parameters

denops: Denops
optional
atexit: unknown

Returns

Promise<void>