🪴 notes

Search

Search IconIcon to open search

node garbage collection

Published Aug 10, 2023 Last updated Nov 25, 2023 Edit Source

1
2
3
4
5
import { setFlagsFromString } from 'v8'; 
import { runInNewContext } from 'vm'; 

setFlagsFromString('--expose_gc'); 
const gc = runInNewContext('gc'); // nocommit gc();

https://stackoverflow.com/questions/27321997/how-to-request-the-garbage-collector-in-node-js-to-run