-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
"Allocation failed - JavaScript heap out of memory" when using incorrect CSS value with a comment #3443
Comments
@dmitriy-drenkalyuk possibly related to: #3434? Can you try the 3.11.0 build and see if you have the same issue? |
@matthew-dean yeah, the same issue is in version 3.11.0. |
@dmitriy-drenkalyuk Ah okay, I'm able to reproduce now. Interesting bug (and no, not related to #3434). |
Played around with the example a bit, and it appears that the value not only has to be incorrect, but the bug also disappears if you remove the # in front of the value. |
@rgroothuijsen Yes, I believe what's happening is that the parser is essentially not recovering the correct position from an invalid color value, so it's going into an infinite loop. |
@matthew-dean Yep, that seems to be what I'm observing so far. I'm not very familiar with the code yet but from what I can tell it creates a save state before processing the color value, does nothing to handle this particular case, and after processing the comment it goes back to the save state to do the same thing. |
Additional observation: the infinite loop only happens if you have a faulty color value and you place the comment in the middle of the line. If you place the comment after the |
I'm getting a similar error, but I don't think it is due to an infinite loop. I am employing heavily nested each loops -- 8 layers deep. Is there a way to optimize memory usage, or provide memory arguments to the lessc command? I'm using the following:
Here is the report file:
|
I have got the same problem. |
Came across something, though I can't entirely explain it. There's a loop starting here that was occurring a lot while I was debugging. It first checks if the current expression is a comment, and if not it continues to checking if it's an entity...which might also be a comment. Somehow, the returned object was indeed of type |
@rgroothuijsen You're saying that solved the memory issue? |
@matthew-dean Yes, the test case provided here immediately exited out with an error. Without the fix, this array just kept growing bigger. |
@rgroothuijsen Can you provide a PR, with your test cases along with a write-up of your findings? It would be much appreciated. |
Hey Matthew, Any idea when will this be published on npm ? @matthew-dean |
Fixed by #3494 |
OS:
Less.js version:
main.less:
(note that the
color
property value is incorrect)Expected result (you can get this if you remove the comment):
Actual result:
The text was updated successfully, but these errors were encountered: