nx.js
NamespacesSwitchFunctions

memoryUsage

memoryUsage(): MemoryUsage

Returns memory usage statistics from the V8 JavaScript engine via V8's HeapStatistics.

Useful for debugging memory leaks and monitoring memory pressure.

Returns

MemoryUsage

Example

const mem = Switch.memoryUsage();
console.log(`Heap used: ${mem.usedHeapSize} bytes`);
console.log(`Heap total: ${mem.totalHeapSize} bytes`);
console.log(`Heap limit: ${mem.heapSizeLimit} bytes`);

On this page