-
Notifications
You must be signed in to change notification settings - Fork 406
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
JavaScript heap out of memory #637
Comments
Additional info. JSON5 was added with #293 I also recall that handlebars engine might have a bigger object structure than others, but I think this is still a valid thread to tug at. |
my own benchmarking: node: @bignass04, what is the total size of your |
We did a quick fix for our CI servers by creating an file named echo $(uname)
if [ "$(uname)" = 'Linux' ]; then
echo 'Linux detected.'
sed -i "s/allFooterData = JSON5.parse(JSON5.stringify(patternlab.data));/allFooterData = JSON.parse(JSON.stringify(patternlab.data));/g" node_modules/patternlab-node/core/lib/patternlab.js
sed -i "s/allData = JSON5.parse(JSON5.stringify(patternlab.data));/allData = JSON.parse(JSON.stringify(patternlab.data));/g" node_modules/patternlab-node/core/lib/patternlab.js
elif [ "$(uname)" = 'Darwin' ]; then
echo 'macOS detected.'
sed -i "" "s/allFooterData = JSON5.parse(JSON5.stringify(patternlab.data));/allFooterData = JSON.parse(JSON.stringify(patternlab.data));/g" node_modules/patternlab-node/core/lib/patternlab.js
sed -i "" "s/allData = JSON5.parse(JSON5.stringify(patternlab.data));/allData = JSON.parse(JSON.stringify(patternlab.data));/g" node_modules/patternlab-node/core/lib/patternlab.js
fi And then adding it to the |
Wow that's a decently involved fix - I will prioritize a better solution. |
@bmuenzenmeyer The total data.json file is 714KB. I don't think we have much pattern-specific data but I haven't done much work on this application yet. |
for reference, mine above was Quite the difference. |
Our |
I've generated some test data and will be using that for further analysis |
Testing:
|
I am going with a pure |
I think I have fixed this with PL Node 2.9.X |
resolved (i think) with 2.9.0 |
I am using Pattern lab Node
v2.8.0
onMac
with Nodev6.9.1
.ERROR
I get the following error when my app is building the handlebars patterns:
Security context: 0x81bb64cfb51
2: string(aka string) [/Users/mnasser/ha50/node_modules/json5/lib/json5.js:~218] [pc=0x1dd9da48b83e] (this=0x81bb6404381 )
3: object(aka object) [/Users/mnasser/ha50/node_modules/json5/lib/json5.js:~433] [pc=0x1dd9da48ee26] (this=0x81bb6404381 )
4: object(aka object) [/Users/mnasser/ha50/node_modules/json5/lib/json5.js:~433] [pc=0x1dd9da48eed4] (this=0x81bb64043...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/Users/mnasser/.nvm/versions/node/v6.9.1/bin/node]
2: node::FatalException(v8::Isolate, v8::Localv8::Value, v8::Localv8::Message) [/Users/mnasser/.nvm/versions/node/v6.9.1/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const, bool) [/Users/mnasser/.nvm/versions/node/v6.9.1/bin/node]
4: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/mnasser/.nvm/versions/node/v6.9.1/bin/node]
5: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object*, v8::internal::Isolate) [/Users/mnasser/.nvm/versions/node/v6.9.1/bin/node]
6: 0x1dd9d9f079a7
sh: line 1: 97019 Abort trap: 6 node scripts/patternlab.js build
RESOLUTION
I found that I can resolve the error if I go to patternlab-node/core/lib/patternlab.js and change line 428 from
allFooterData = JSON5.parse(JSON5.stringify(patternlab.data));
to
allFooterData = JSON.parse(JSON.stringify(patternlab.data));
and change line 373 from
allData = JSON5.parse(JSON5.stringify(patternlab.data));
to
allData = JSON.parse(JSON.stringify(patternlab.data));
BENCHMARKS
The build times were recorded with one time stamp displayed immediately after line 32 of patternlab-node/core/lib/patternlab.js as the start time and one immediately after the build process is completed as the end time.
The text was updated successfully, but these errors were encountered: