Merge remote-tracking branch 'origin/dev' into Dev-Carl
This commit is contained in:
19
src/pages/heap-snapshot.astro
Normal file
19
src/pages/heap-snapshot.astro
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
import { getHeapSnapshot } from "v8";
|
||||
import * as fs from "fs";
|
||||
|
||||
// Create a named heap snapshot
|
||||
const snapshotStream = getHeapSnapshot();
|
||||
const fileName = `heap-${Date.now()}.heapsnapshot`;
|
||||
const fileStream = fs.createWriteStream(fileName);
|
||||
|
||||
snapshotStream.pipe(fileStream);
|
||||
|
||||
fileStream.on("finish", () => {
|
||||
console.log(`Heap snapshot saved to ${fileName}`);
|
||||
});
|
||||
|
||||
fileStream.on("error", (err) => {
|
||||
console.error("Error writing heap snapshot:", err);
|
||||
});
|
||||
---
|
||||
Reference in New Issue
Block a user