You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During some quick testing on the Swift3 branch noticed that if I do evaluation on an extremely long series of calculations (say simple +-*/ stuff on randomly generated integers where the number of operators might be 1000 or more) I'm seeing crashes in DDMathParser.
The strange thing is that it only appears to happen when running the evaluation on a background thread (either via OperationQueue or DispatchQueue).
Is this expected? Am I using it wrong? Obviously if I break down the long series into an array of short calculations, and handle each item separately, it works fine but seems like I shouldn't need to do this.
The text was updated successfully, but these errors were encountered:
joshdistler
changed the title
Possible issue with large evaluation
Possible issue with large evaluation?
Jul 31, 2016
I just reproduced this, and my gut feeling is that this is an issue related to blowing out the execution stack. When I saw this, I was nearly 400 frames deep in execution, and I'm wondering if at that point we exceed the amount of space that Swift runtime allocates for the execution stack.
I just had the thought that you could do this by doing a DFS traversal of the expression tree without recursing. The current implementation of evaluation is essentially recursing through the entire tree, and on a huge tree, that blows the stack.
Hi Dave.
During some quick testing on the Swift3 branch noticed that if I do evaluation on an extremely long series of calculations (say simple +-*/ stuff on randomly generated integers where the number of operators might be 1000 or more) I'm seeing crashes in DDMathParser.
The strange thing is that it only appears to happen when running the evaluation on a background thread (either via OperationQueue or DispatchQueue).
Is this expected? Am I using it wrong? Obviously if I break down the long series into an array of short calculations, and handle each item separately, it works fine but seems like I shouldn't need to do this.
The text was updated successfully, but these errors were encountered: