Optimization

Manual memory optimization and GC.

1 min readEdit this page

Optimize

import { optimizer } from '@restjs/memory'
 
const result = await optimizer.optimize()
result.freedMb
result.gcTriggered
result.actions

GC

import { triggerGC, isGCAvailable } from '@restjs/memory'
 
if (isGCAvailable()) triggerGC()

Enable with: node --expose-gc dist/main.js