Skip to content

Memory leaks during tests #1024

@konstantinzelinsky

Description

@konstantinzelinsky

We are trying to switch to this library from node-canvas. Everything seems to be fine and working except for our e2e tests.
We have some number of tests, and in some tests we use canvas and in other tests canvas is not used. During the tests we see memory leaks (about +60mb on each test).
I found that these memory leaks can be partially fixed if the import from @napi-rs/canvas is dynamic, i.e. the import is only executed in tests that use canvas. In this case, I only observe memory leaks in a part of the tests (using canvas). There seems to be some problem with the import in test environment based on that

In basic usage while the server is running, we don't see any memory leaks

Environment

  • node: v22.13.1
  • @napi-rs/canvas: v0.1.68
  • jest: v29.2.2
  • OS: macOS arm / debian 11 x64

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions