Skip to content

Commit 34dd7a0

Browse files
authored
Add definitions for RTrace hooks (#1558)
1 parent 00bc624 commit 34dd7a0

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/rtrace/index.d.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export declare interface RtraceOptions {
2424
/** Function being called with information messages. */
2525
oninfo?: (msg: string) => void,
2626
/** Obtains the module's memory instance. */
27-
getMemory()
27+
getMemory(): WebAssembly.Memory;
2828
}
2929

3030
export declare class Rtrace {
@@ -38,4 +38,25 @@ export declare class Rtrace {
3838

3939
/** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */
4040
check(): number;
41+
42+
/** A function that is called when an allocation occurs. */
43+
onalloc(ptr: number): void;
44+
45+
/** A function that is called when a heap allocation resize occurs. */
46+
onresize(ptr: number, oldSize: number): void;
47+
48+
/** A function that is called when an object is moved on the heap. */
49+
onmove(oldPtr: number, newPtr: number): void;
50+
51+
/** A function that is called when a heap allocation is freed. */
52+
onfree(ptr: number): void;
53+
54+
/** A function that is called when a reference counting increment occurs. */
55+
onincrement(ptr: number): void;
56+
57+
/** A function that is called when a reference counting decrement occurs. */
58+
ondecrement(ptr: number): void;
59+
60+
/** Obtains information about a block. */
61+
getBlockInfo(ptr: number): BlockInfo;
4162
}

0 commit comments

Comments
 (0)