Skip to content

fix: imhex uses all memory#239

Merged
paxcut merged 1 commit into
masterfrom
fix/more_memory_issues
May 30, 2026
Merged

fix: imhex uses all memory#239
paxcut merged 1 commit into
masterfrom
fix/more_memory_issues

Conversation

@paxcut
Copy link
Copy Markdown
Collaborator

@paxcut paxcut commented May 30, 2026

The issue is caused by loops like the following

     while (!sequence(tkn::Separator::RightBrace)) {
            auto statement = parseFunctionStatement();
            if (statement == nullptr)
                continue;

            body.push_back(std::move(statement));
        }

so that if the function does nor advance the token pointer, the loop never ends even if errors are generated. Some of these loops solve that by calling

          if (hasErrors())
                break;

in which case generating errors is enough to avoid the problem. In this fix I changed all potentially exploding loops to check for errors and I tested the result with all the types of variables that use the loops like try/catch, unions, conditionals, match statements , ... and the problem seems resolve for good.

The issue is caused by loops like the following
```cpp
     while (!sequence(tkn::Separator::RightBrace)) {
            auto statement = parseFunctionStatement();
            if (statement == nullptr)
                continue;

            body.push_back(std::move(statement));
        }
```
so that if the function does nor advance the token pointer, the loop never ends even if errors are generated. Some of these loops solve that by calling
```cpp
          if (hasErrors())
                break;
```
in which case generating errors is enough to avoid the problem. In this fix I changed all potentially exploding loops to check for errors and I tested the result with all the types of variables that use the loops like try/catch, unions, conditionals, match statements , ... and the problem seems resolve for good.
@paxcut paxcut merged commit 059a629 into master May 30, 2026
5 checks passed
@paxcut paxcut deleted the fix/more_memory_issues branch May 30, 2026 00:56
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

Successfully merging this pull request may close these issues.

1 participant