Skip to content

Commit

Permalink
made sure to free the encoded name
Browse files Browse the repository at this point in the history
  • Loading branch information
carzh committed Nov 2, 2023
1 parent 3cbb01a commit 4235608
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions js/web/lib/wasm/wasm-training-core-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const getModelInputOutputNamesLoop =
ifErrCodeCheckLastError(name, `Can't get input or output name -- is input: ${isInput}, index ${i}`, false);

names.push(wasm.UTF8ToString(name));
wasm._free(name);
} else {
throw new Error(NO_TRAIN_FUNCS_MSG);
}
Expand Down Expand Up @@ -506,14 +507,13 @@ export const loadParametersBuffer =
}
};

export const releaseTrainingSessionAndCheckpoint =
(checkpointId: number, sessionId: number): void => {
const wasm = getInstance();
export const releaseTrainingSessionAndCheckpoint = (checkpointId: number, sessionId: number): void => {
const wasm = getInstance();

if (wasm._OrtTrainingReleaseSession) {
wasm._OrtTrainingReleaseSession(sessionId);
}
if (wasm._OrtTrainingReleaseCheckpoint) {
wasm._OrtTrainingReleaseCheckpoint(checkpointId);
}
};
if (wasm._OrtTrainingReleaseSession) {
wasm._OrtTrainingReleaseSession(sessionId);
}
if (wasm._OrtTrainingReleaseCheckpoint) {
wasm._OrtTrainingReleaseCheckpoint(checkpointId);
}
};

0 comments on commit 4235608

Please sign in to comment.