MCPcopy Index your code
hub / github.com/anomalyco/opencode / run

Function run

packages/opencode/src/cli/heap.ts:16–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 if (timer) return
15
16 const run = async () => {
17 if (lock) return
18
19 const stat = process.memoryUsage()
20 if (stat.rss <= LIMIT) {
21 armed = true
22 return
23 }
24 if (!armed) return
25
26 lock = true
27 armed = false
28 const file = path.join(
29 Global.Path.log,
30 `heap-${process.pid}-${new Date().toISOString().replace(/[:.]/g, "")}.heapsnapshot`,
31 )
32 await Promise.resolve()
33 .then(() => writeHeapSnapshot(file))
34 .catch(() => {})
35
36 lock = false
37 }
38
39 timer = setInterval(() => {
40 void run()

Callers 8

startFunction · 0.70
index.tsFile · 0.50
streamFunction · 0.50
index.tsFile · 0.50
task.tsFile · 0.50
apply_patch.tsFile · 0.50
read.tsFile · 0.50
shell.tsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected