Skip to content

Maximum call stack size exceeded if parsing a lot of bit fields #233

Description

@jonathanfady

Hi !
I am trying out your package to parse a not so large binary data chunk into a lot of booleans (1200), some integers (50) and some strings (20), and I am getting a Maximum call stack size exceeded when running parse().
My booleans are 1-bit long (bit1) and the rest of the data is split among unit8, int8, uint16, int16, uint32, int32, float and string.
If I change the booleans to be parsed as uint8 or something else, the code will run.
The whole parsing code is running in a Web Worker but I don't think that changes anything.

The error is generated from the following line, so I guess the TODO makes sense !

private generateBit(ctx: Context) {
    // TODO find better method to handle nested bit fields
    const parser = JSON.parse(JSON.stringify(this));
    parser.options = this.options;

Could you look into this if you ever have the time ?
I would love to use your parser to avoid writting the entire parsing code by hand :)
If you have any other parser to suggest that manages a lot of bitfields that would also help.
Thanks for your great work !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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