summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts9
-rw-r--r--cli/tests/heapstats.js8
-rw-r--r--cli/tests/integration_tests.rs2
3 files changed, 14 insertions, 5 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 3fbf3d94d..612ebeccc 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -1166,6 +1166,15 @@ declare namespace Deno {
bytesReceived: number;
}
+ export interface MemoryUsage {
+ rss: number;
+ heapTotal: number;
+ heapUsed: number;
+ external: number;
+ }
+
+ export function memoryUsage(): MemoryUsage;
+
export interface RequestEvent {
readonly request: Request;
respondWith(r: Response | Promise<Response>): void;
diff --git a/cli/tests/heapstats.js b/cli/tests/heapstats.js
index 0ed623e56..fba9e66d9 100644
--- a/cli/tests/heapstats.js
+++ b/cli/tests/heapstats.js
@@ -2,15 +2,15 @@
"use strict";
function allocTest(alloc, allocAssert, deallocAssert) {
- // Helper func that GCs then returns heapStats
+ // Helper func that GCs then returns memory usage
const sample = () => {
// deno-lint-ignore no-undef
gc();
- return Deno.core.heapStats();
+ return Deno.memoryUsage();
};
- const delta = (t1, t2) => t2.usedHeapSize - t1.usedHeapSize;
+ const delta = (t1, t2) => t2.heapUsed - t1.heapUsed;
- // Sample "clean" heapStats
+ // Sample "clean" heap usage
const t1 = sample();
// Alloc
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 5067b8163..f856b90b8 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -3250,7 +3250,7 @@ console.log("finish");
});
itest!(heapstats {
- args: "run --quiet --v8-flags=--expose-gc heapstats.js",
+ args: "run --quiet --unstable --v8-flags=--expose-gc heapstats.js",
output: "heapstats.js.out",
});