★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/32426Nouvelle recherche | Portail wanayoo
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

src: use single ObjectTemplate for TextDecoder #32426

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Mar 22, 2020

ObjectTemplates are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: #32424

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: nodejs#32424
@nodejs-github-bot nodejs-github-bot added the c++ label Mar 22, 2020
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Mar 22, 2020

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Mar 22, 2020

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Mar 22, 2020

Copy link
Member

@bnoordhuis bnoordhuis left a comment

ObjectTemplates are not garbage-collected like regular objects (for some reason).

They are but they're also cached on instantiation. The cache is of bounded size so the memory leak is bounded too but it's still pretty big (on the order of 1 million entries, I think.)

gengjiawen added a commit that referenced this issue Mar 26, 2020
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: #32424

PR-URL: #32426
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@gengjiawen
Copy link
Member

@gengjiawen gengjiawen commented Mar 26, 2020

Landed in b950daf

@gengjiawen gengjiawen closed this Mar 26, 2020
MylesBorins added a commit that referenced this issue Mar 26, 2020
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: #32424

PR-URL: #32426
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins MylesBorins mentioned this pull request Mar 26, 2020
@addaleax addaleax deleted the textdecoder-memoryleak branch Mar 28, 2020
@targos targos added backport-blocked-v12.x and removed backport-blocked-v12.x labels Apr 22, 2020
targos added a commit to targos/node that referenced this issue Apr 25, 2020
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: nodejs#32424

PR-URL: nodejs#32426
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos added a commit that referenced this issue Apr 28, 2020
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: #32424

PR-URL: #32426
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants