Skip to content

Commit

Permalink
Better comment
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Heitz <pascal.heitz@absa.africa>
  • Loading branch information
Pascal Heitz committed Dec 9, 2020
1 parent b5cf8eb commit 3f3eb2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wrappers/node/test/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export const sleep = (timeout: number) => new Promise((resolve, reject) => setTi

let garbageCollectionBeforeExitIsScheduled = false

// For some reason, The Rust library segfaults if global.gc() is not called explicitly.
// For some (yet unknown) reason, The Rust library segfaults on exit if global.gc() is not called explicitly.
// To solve this issue, we call global.gc() on `beforeExit` event.
// NB: This solution only works with Mocha.
// With Jest the 'beforeExit' event doesn't seem fired, so we are instead still using --forceExit before it segfaults.
const scheduleGarbageCollectionBeforeExit = () => {
if (!garbageCollectionBeforeExitIsScheduled) {
assert(global.gc)
Expand Down

0 comments on commit 3f3eb2f

Please sign in to comment.