Skip to content

Fix some memory leaks #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 6, 2025
Merged

Fix some memory leaks #121

merged 2 commits into from
Apr 6, 2025

Conversation

khaledhosny
Copy link
Contributor

Fixes #120

Call removeFunction() for functions added by addFunction(), as well as
calling hb_draw_funcs_destroy() when destroying the font.
It seems that this.blob etc are always null when afterEach callback is
called, so we now use global variables instead.
if (face) face.destroy();
if (font) font.destroy();
if (buffer) buffer.destroy();
blob = face = font = buffer = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh whoops. Apparently shared context via this only works if the afterEach is defined in a describe. I think I like this fix since it's compatible with the new-ish node:test.

@khaledhosny khaledhosny merged commit 5c28889 into main Apr 6, 2025
1 check passed
@khaledhosny khaledhosny deleted the issue-120 branch April 6, 2025 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory increase when using shapeWithTrace
2 participants