Fix memory leak when using continue or break statement with syntaxError
Does this patch increase memory consumption in the normal (no parse error) case?
Yes it does. For example the regression-test-issue-1555.js test fails if the heap size is not increased.
Would it be possible to free the memory at its regular place as well?
I don't think so. I have debugging this issue a very long time and didn't find any better methods to keep track of possible non freed pointers.
I mean when a pointer is not needed, it could be removed from the tracker and free it. I suspect we keep pointers too long around this way.
https://github.com/jerryscript-project/jerryscript/blob/8d44eed661fc82324e178675937c88d9b1b34573/jerry-core/parser/js/js-parser.c#L3254
The parser already does a lot of cleanup on throw. If we could put this branch list into some local context (a chain list with a head), we could cleanup it without complex structures.
Currently it is a chain list not a complex structure and stored in the context to easily pass around.
Not the complexity, but it has while loops. The design is better if less scanning is needed.
Is it operating like a stack btw? So we usually remove items form the end?
No, it's not like stack.