njam / citygml-to-3dtiles

Convert from CityGML to Cesium 3D Tiles.
Apache License 2.0
160 stars 41 forks source link

CLI: 'NODE_OPTIONS=--max-old-space-size=10000' is not recognized #14

Closed honglzhu closed 4 years ago

honglzhu commented 4 years ago

When I tried to run the command as shown below in Windows 10 PowerShell as Admin: NODE_OPTIONS=--max-old-space-size=10000 citygml-to-3dtiles "data\delft_3dfier.gml" "3dtiles_delft\" I got below: NODE_OPTIONS=--max-old-space-size=10000 : The term 'NODE_OPTIONS=--max-old-space-size=10000' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

When I first ran: citygml-to-3dtiles "data\Delft_3dfier.gml" "3dtiles_delft_large\" I got OOM as shown below:

==== JS stack trace =========================================

0: ExitFrame [pc: 00007FF786F6BBED]

Security context: 0x02a63ff40921 1: appendElement [000003781E808BD1] [C:\Users\honglzhu\AppData\Roaming\npm\node_modules\citygml-to-3dtiles\node_modules\xmldom\sax.js:~388] [pc=00000155D1BC9168](this=0x017ca7140399 ,0x03f415d32959 ,0x014a7fac26b1 ,0x014a7fac65f9 <Object map = 000001E8BE14AD01...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF786350B5F napi_wrap+110655 2: 00007FF7862FC606 v8::base::CPU::has_sse+67398 3: 00007FF7862FD3F4 v8::base::CPU::has_sse+70964 4: 00007FF786B220BE v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF786B09811 v8::SharedArrayBuffer::Externalize+785 6: 00007FF7869D087C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468 7: 00007FF7869DBBC0 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312 8: 00007FF7869D86B4 v8::internal::Heap::PageFlagsAreConsistent+3188 9: 00007FF7869CDDC3 v8::internal::Heap::CollectGarbage+1283 10: 00007FF7869CC554 v8::internal::Heap::AllocateExternalBackingStore+1396 11: 00007FF7869EE624 v8::internal::Factory::NewFillerObject+196 12: 00007FF786749441 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1681 13: 00007FF786F6BBED v8::internal::SetupIsolateDelegate::SetupHeap+517453 14: 00000155D1BC9168`

Since I am not familiar with NodeJS, I do not know how to workaround it to increase the heap size.

Thanks.

njam commented 4 years ago

NODE_OPTIONS is an "environment variable" that can be passed to NodeJS. I'm not very familiar with Windows/PowerShell. But it seems passing environment variables works differently.

Does this work?

$env:NODE_OPTIONS = '--max-old-space-size=10000'; citygml-to-3dtiles --help

See https://stackoverflow.com/a/1422082/3090404

Alternatively you could try to use Windows "Bash" command, which should accept the command the way it's documented in the readme (POSIX/Linux syntax).

honglzhu commented 4 years ago

Thank you for giving me the hints.
I then found a link here: https://support.snyk.io/hc/en-us/articles/360002046418-JavaScript-heap-out-of-memory. It has a screenshot towards the end of that page. Yes, it is just a Windows environment variable. Once I set it in System Properties > Advanced > Environment Variable > System variables. with Variable name: NODE_OPTIONS Value: --max-old-space-size=10240 It works! I appreciate your nice work and your prompt assistance!

njam commented 4 years ago

Good to hear that it worked!