Skip to content

Excessive Memory Consumption Due to Token Inclusion in AST #1413

@Iswaryasl

Description

@Iswaryasl

I'm experiencing an issue with the recast library where the memory consumption becomes excessively high due to token data being included in the AST (Abstract Syntax Tree) even when the tokens option is set to false.

Steps to Reproduce:

  1. Use the recast.parse function with the following options
    const ast = recast.parse(code, { tokens: false, loc: true });

  2. Observe the resulting AST object

Expected Behavior:

The tokens property should not be present in the resulting AST if the tokens option is set to false. Memory usage should be reasonable for the size of the AST.

Actual Behavior:

Despite setting the tokens option to false, the resulting AST still includes a tokens property, which leads to excessive memory consumption.

Additional Information:

Recast version: 0.22.0
Node.js version: 14.21.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions