Skip to content

memory leak #6

@polomsky

Description

@polomsky

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions