MCPcopy Index your code
hub / github.com/simstudioai/sim / startMemoryTelemetry

Function startMemoryTelemetry

apps/sim/lib/monitoring/memory-telemetry.ts:15–39  ·  view source on GitHub ↗
(intervalMs = 60_000)

Source from the content-addressed store, hash-verified

13let started = false
14
15export function startMemoryTelemetry(intervalMs = 60_000) {
16 if (started) return
17 started = true
18
19 const timer = setInterval(() => {
20 const mem = process.memoryUsage()
21 const heap = v8.getHeapStatistics()
22
23 logger.info('Memory snapshot', {
24 heapUsedMB: Math.round(mem.heapUsed / MB),
25 heapTotalMB: Math.round(mem.heapTotal / MB),
26 rssMB: Math.round(mem.rss / MB),
27 externalMB: Math.round(mem.external / MB),
28 arrayBuffersMB: Math.round(mem.arrayBuffers / MB),
29 heapSizeLimitMB: Math.round(heap.heap_size_limit / MB),
30 nativeContexts: heap.number_of_native_contexts,
31 activeResources:
32 typeof process.getActiveResourcesInfo === 'function'
33 ? process.getActiveResourcesInfo().length
34 : -1,
35 uptimeMin: Math.round(process.uptime() / 60),
36 })
37 }, intervalMs)
38 timer.unref()
39}

Callers 1

registerFunction · 0.85

Calls 1

infoMethod · 0.80

Tested by

no test coverage detected