Memory

Leak Detection

Automatic detection and cleanup of memory leaks.

1 min readDocumentationEdit this page

What is detected#

TypeAuto Fix
Event listener accumulationWarns
Cache overflowPrunes
Timer accumulationWarns
Global pollutionWarns
Unused module cacheClears
High heap usageTriggers GC

Track resources#

typescript
import { trackTimer, trackCache } from '@AxilJS/memory'
 
const timer = trackTimer(setTimeout(work, 5000))
const cache = trackCache('sessions', new Map(), 10000)

Per-request#

typescript
import { memoryMiddleware } from '@AxilJS/memory'
 
app.use(memoryMiddleware({ leakThresholdMb: 50, exposeHeader: true }))

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY