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

Add the ability to limit the number of array lengths collected #180

Open
btiernay opened this issue Jul 25, 2022 · 0 comments
Open

Add the ability to limit the number of array lengths collected #180

btiernay opened this issue Jul 25, 2022 · 0 comments

Comments

@btiernay
Copy link

I believe this is one area of the tool that can cause heap exhaustion when profiling over a large number of documents. In stream.js's addToType:

    // recurse into arrays by calling `addToType` for each element
    if (typeName === 'Array') {
      type.types = type.types || {};
      type.lengths = type.lengths || [];
      type.lengths.push(value.length); // <-- Grows without bound
      value.forEach(v => addToType(path, v, type.types));

It would be useful to have an option that would skip this, use a reservoir, or somehow cap the collection of lengths.

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