fix: attempt to call garbage collector after purging stored item

This commit is contained in:
Vjacheslav Trushkin 2022-10-20 21:07:57 +03:00
parent d27c6e36a8
commit 3cec4e44d5
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,11 @@ export function cleanupStoredItem<T>(storage: MemoryStorage<T>, storedItem: Memo
stopTimer(storage);
}
// Purge unused memory if garbage collector global is exposed
try {
global.gc?.();
} catch {}
return true;
}