Skip to content
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

fix(node): use cppgc for managing X509Certificate #21999

Merged
merged 2 commits into from
Jan 20, 2024

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Jan 19, 2024

Introduces the first cppgc backed Resource into Deno.

This fixes the memory leak when using X509Certificate

Comparison:

import { X509Certificate } from 'node:crypto';

const r = Deno.readFileSync('cli/tests/node_compat/test/fixtures/keys/agent1-cert.pem');

setInterval(() => {
  for (let i = 0; i < 10000; i++) {
    const cert = new X509Certificate(r);
  }
}, 1000);

Memory usage after 5 secs

main: 1692MB
cppgc: peaks at 400MB

@littledivy littledivy mentioned this pull request Jan 19, 2024
1 task
@littledivy littledivy marked this pull request as ready for review January 20, 2024 03:16
@littledivy littledivy added this to the 1.40 milestone Jan 20, 2024
@littledivy littledivy requested review from bartlomieju and mmastrac and removed request for bartlomieju January 20, 2024 04:01
Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

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

LGTM

@littledivy littledivy merged commit 28f6417 into denoland:main Jan 20, 2024
15 of 17 checks passed
@littledivy littledivy deleted the cppgc_firstuse branch January 20, 2024 16:30
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.

2 participants