From 071eb1f97228ba0fb5d2f285170c5bfdbe525d55 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Mon, 15 Apr 2024 11:23:22 +0200 Subject: [PATCH] refactor: avoid adding schemas to AJV to avoid memory leak --- packages/core/src/interaction-output.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/interaction-output.ts b/packages/core/src/interaction-output.ts index ee641108f..3a2d1768f 100644 --- a/packages/core/src/interaction-output.ts +++ b/packages/core/src/interaction-output.ts @@ -30,7 +30,8 @@ const { debug, warn } = createLoggers("core", "interaction-output"); // Strict mode has a lot of other checks and it prevents runtime unexpected problems // TODO: in the future we should use the strict mode -const ajv = new Ajv({ strict: false }); +// addUsedSchema may cause memory leak in our use-case / environment (see https://github.com/eclipse-thingweb/node-wot/issues/1062) +const ajv = new Ajv({ strict: false, addUsedSchema: false }); addFormats(ajv); export class InteractionOutput implements WoT.InteractionOutput {