-
-
Notifications
You must be signed in to change notification settings - Fork 672
Runtime error during GC #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On a first glimpse it appears that there's something wrong when compiling for ( let currentEdge = nextOppositeEdge; currentEdge !== previousOppositeEdge.next; currentEdge = currentEdge.next! ) {
currentEdge.face = face;
} Changing that loop to var currentEdge = nextOppositeEdge;
while (currentEdge !== previousOppositeEdge.next) {
currentEdge.face = face;
currentEdge = currentEdge.next!;
} gets rid of the error. There have been quite a few problems with how we compile for loops in the past already, which originates from the complexity introduced by managing various shortcuts while still keeping track of ARC. Makes me wonder whether it'd be more maintainable if all those shortcuts were removed and kept to Binaryen to optimize later. |
@dcodeIO thanks for the workaround, it worked just fine in the original code! |
Gave this a shot in the PR linked above. Can you give that a try with your full code base? |
@dcodeIO sure 👍
Overall this seems to be working fine without any regressions. Thanks! |
Re-tested on the latest nightly:
Thanks for your help, @dcodeIO! |
First of all, I'm sorry for such complex code example (even after a ~10x reduction from the original class) - it's extremely tricky to catch. But I believe that it's not about the algorithm itself, but about a specific memory layout. Originally I caught it after a few seconds of running my app (when new allocation triggered garbage collection), but it can be reproduced reliably by calling
gc.collect()
manually - like inTest
's constructor.Link to webassembly studio: https://webassembly.studio/?f=wl2iowedpud
Code
Stack trace
The text was updated successfully, but these errors were encountered: