Skip to content

RTrace TypeScript Types Update #1558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}