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
jsonStringify
util regularly causes out of memory crash
#4414
Comments
|
jsonStringify
util consistently causes out of memory crashjsonStringify
util regularly causes out of memory crash
@dvtate Thanks. We really would need sample code to generate such an object so we can confirm the behavior. |
Ok so we're emulating a webgl environment in headless node unit tests for our 100k+ loc propietary project but I think I can make an simpler example this weekend that can replicate the results |
Ok so I managed to recreate the problem without using company's code. It seems that mocha is trying to print the entirety of each In the test I also included With only 5 labels the test fails very slowly and prints a lot of grabage to the terminal, but doubling the number of labels causes the test to take several minutes and several hundred megs of RAM. |
I'd recommend:
|
thanks for getting that. the lib we use internally for assertions, unexpected, has a default maximum depth setting. I think adding a feature like that might work. |
this code is not really so easy to work with... not having luck simply patching it, but feel free to take a crack at it to solve this immediate problem. I think this is a dupe of #3675 anyway. |
Yea, fixing #3675 would probably also fix this. Unfortunately I'm busy with work+uni so not a lot of free time currently. The example I made is kinda weird because it's testing something that normally would only be run in browser using node. Right now at work I replaced chai with builtin assert so at least it's not an immediate problem, but would improve readability |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
toJSON
methods that remove the cyclic references (inJSON.stringify
spec).Steps to Reproduce
THREE.Object3D
instances ()jsonStringify
orcannonicalize
on that objectExpected behavior: [What you expect to happen]
console.log
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
100% of time with complex objects and even simple objects with deep complex references
Versions
Additional Information
Will include some traces below
Reccomendations
Two possible routes:
JSON.stringify
spec more closely.toJSON
method you should use itThe text was updated successfully, but these errors were encountered: