Skip to content

Commit

Permalink
Add definitions for RTrace hooks (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtenner authored Nov 23, 2020
1 parent 00bc624 commit 34dd7a0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/rtrace/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export declare interface RtraceOptions {
/** Function being called with information messages. */
oninfo?: (msg: string) => void,
/** Obtains the module's memory instance. */
getMemory()
getMemory(): WebAssembly.Memory;
}

export declare class Rtrace {
Expand All @@ -38,4 +38,25 @@ export declare class Rtrace {

/** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */
check(): number;

/** A function that is called when an allocation occurs. */
onalloc(ptr: number): void;

/** A function that is called when a heap allocation resize occurs. */
onresize(ptr: number, oldSize: number): void;

/** A function that is called when an object is moved on the heap. */
onmove(oldPtr: number, newPtr: number): void;

/** A function that is called when a heap allocation is freed. */
onfree(ptr: number): void;

/** A function that is called when a reference counting increment occurs. */
onincrement(ptr: number): void;

/** A function that is called when a reference counting decrement occurs. */
ondecrement(ptr: number): void;

/** Obtains information about a block. */
getBlockInfo(ptr: number): BlockInfo;
}

0 comments on commit 34dd7a0

Please sign in to comment.