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

memory leak #6

Open
polomsky opened this issue Jun 8, 2023 · 0 comments
Open

memory leak #6

polomsky opened this issue Jun 8, 2023 · 0 comments

Comments

@polomsky
Copy link

polomsky commented Jun 8, 2023

Each call of validate function will consume about 16MB! of array buffer memory. Node 18.

const SAMLValidator = require('@authenio/samlify-node-xmllint');

const XML = `<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    ID="aaf23196-1773-2113-474a-fe114412ab72"
    Version="2.0"
    IssueInstant="2004-12-05T09:21:59Z">
</samlp:AuthnRequest>`;

console.log(process.memoryUsage());
SAMLValidator.validate(XML);
console.log(process.memoryUsage());
SAMLValidator.validate(XML);
console.log(process.memoryUsage());

Memory before call:

{
  rss: 41086976,
  heapTotal: 14307328,
  heapUsed: 9071328,
  external: 406411,
  arrayBuffers: 16610
}

Memory after 2 calls:

{
  rss: 58294272,
  heapTotal: 18771968,
  heapUsed: 13314016,
  external: 34080083,
  arrayBuffers: 33654784
}
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

No branches or pull requests

1 participant