dantheman
dantheman16mo ago

How to release node:zlib resources

I have some testcases which use the node:zlib polyfill and I'm having a bit of trouble getting the tests to pass. Here's a very basic example:
import { createDeflate } from 'node:zlib';
Deno.test('deflate teardown', async () => {
const deflate = createDeflate();
deflate.close();
await new Promise(ok => setTimeout(ok, 1000));
});
import { createDeflate } from 'node:zlib';
Deno.test('deflate teardown', async () => {
const deflate = createDeflate();
deflate.close();
await new Promise(ok => setTimeout(ok, 1000));
});
When I run this, Deno finds a leak:
error: Leaking resources:
- A "zlib" resource (rid 3) was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
error: Leaking resources:
- A "zlib" resource (rid 3) was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
Am I missing something, or is this an issue with the node:zlib polyfill?
1 Reply
dantheman
danthemanOP16mo ago
@littledivy maybe you have a quite take on this ^_^