{"action":"created","issue":{"url":"https://api.github.com/repos/w8r/martinez/issues/74","repository_url":"https://api.github.com/repos/w8r/martinez","labels_url":"https://api.github.com/repos/w8r/martinez/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/w8r/martinez/issues/74/comments","events_url":"https://api.github.com/repos/w8r/martinez/issues/74/events","html_url":"https://github.com/w8r/martinez/issues/74","id":312058587,"number":74,"title":"Crash: JavaScript heap out of memory","user":{"login":"mojodna","id":45,"avatar_url":"https://avatars2.githubusercontent.com/u/45?v=4","gravatar_id":"","url":"https://api.github.com/users/mojodna","html_url":"https://github.com/mojodna","followers_url":"https://api.github.com/users/mojodna/followers","following_url":"https://api.github.com/users/mojodna/following{/other_user}","gists_url":"https://api.github.com/users/mojodna/gists{/gist_id}","starred_url":"https://api.github.com/users/mojodna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mojodna/subscriptions","organizations_url":"https://api.github.com/users/mojodna/orgs","repos_url":"https://api.github.com/users/mojodna/repos","events_url":"https://api.github.com/users/mojodna/events{/privacy}","received_events_url":"https://api.github.com/users/mojodna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-04-06T17:37:53Z","updated_at":"2018-05-18T07:33:51Z","closed_at":null,"author_association":"NONE","body":"Using Node-8.11.1 (or 9.11.1, though the stack trace is from 8), martinez crashes the runtime with this pair of geometries: https://gist.github.com/mojodna/6e4ed77135ffdb629577574298307dd6\r\n\r\nStandalone reproduction:\r\n\r\n```javascript\r\nconst martinez = require(\"martinez-polygon-clipping\");\r\n\r\nconst a = [[[117.659922722,3.255275783000087],[117.64844811300017,3.246039130000042],[117.63795006600017,3.248724677000112],[117.63331139400017,3.268215236000103],[117.62484785200004,3.283270575000117],[117.57178795700011,3.313137111000017],[117.55640709700006,3.331854559000078],[117.54363040500002,3.354803778000147],[117.53467858200011,3.379380601000079],[117.53126061300006,3.403143622000158],[117.54151451900012,3.428452867000118],[117.56666100400011,3.438421942000105],[117.62525475400005,3.437689520000077],[117.64047285199999,3.436509507000054],[117.65699303500017,3.433539130000128],[117.67156009200019,3.426988023000064],[117.68165123800006,3.415513414000102],[117.68392988400015,3.399603583000086],[117.68197675900004,3.37750885600002],[117.67725670700011,3.356431382000082],[117.66537519600016,3.329291083000072],[117.66732832099999,3.271551825000117],[117.659922722,3.255275783000087]]];\r\nconst b = [[[117.6315403,3.2711246],[117.631605,3.2711063],[117.6315993,3.2710864],[117.6321104,3.2709415],[117.6320843,3.2708497],[117.6316732,3.2709663],[117.631666,3.2709411],[117.6315646,3.2709699],[117.6315529,3.2709289],[117.6314897,3.2709469],[117.6315403,3.2711246]]];\r\n\r\nmartinez.intersection(a, b);\r\n```\r\n\r\nStack trace:\r\n\r\n```\r\n<--- Last few GCs --->\r\n\r\n[98975:0x103001800]     6728 ms: Mark-sweep 578.0 (585.6) -> 578.0 (585.6) MB, 138.1 / 0.0 ms  allocation failure GC in old space requested\r\n[98975:0x103001800]     6867 ms: Mark-sweep 578.0 (585.6) -> 577.9 (582.6) MB, 139.0 / 0.0 ms  last resort GC in old space requested\r\n[98975:0x103001800]     7007 ms: Mark-sweep 577.9 (582.6) -> 577.9 (582.6) MB, 140.2 / 0.0 ms  last resort GC in old space requested\r\n\r\n\r\n<--- JS stacktrace --->\r\n\r\n==== JS stack trace =========================================\r\n\r\nSecurity context: 0x34e1f74a57c1 <JSObject>\r\n    1: connectEdges(aka connectEdges) [/Users/seth/src/americanredcross/osm-stats-workers/node_modules/martinez-polygon-clipping/dist/martinez.js:~1091] [pc=0x3b6e887061d1](this=0x34e11aa022d1 <undefined>,sortedEvents=0x34e1c508a031 <JSArray[39]>,operation=0)\r\n    2: boolean(aka boolean) [/Users/seth/src/americanredcross/osm-stats-workers/node_modules/martinez-polygon-clipping/dist/martinez.js:13...\r\n\r\nFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory\r\n 1: node::Abort() [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 4: v8::internal::Factory::NewUninitializedFixedArray(int) [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 5: v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 6: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/seth/.nvm/versions/node/v8.11.1/bin/node]\r\n 7: 0x3b6e885842fd\r\n 8: 0x3b6e887061d1\r\n 9: 0x3b6e8863d196\r\n10: 0x3b6e8863d196\r\n11: 0x3b6e8863d196\r\n12: 0x3b6e8863d196\r\n13: 0x3b6e8863d196\r\n14: 0x3b6e8863d196\r\n15: 0x3b6e8863d196\r\nAbort trap: 6\r\n```"},"comment":{"url":"https://api.github.com/repos/w8r/martinez/issues/comments/390121508","html_url":"https://github.com/w8r/martinez/issues/74#issuecomment-390121508","issue_url":"https://api.github.com/repos/w8r/martinez/issues/74","id":390121508,"user":{"login":"jdesboeufs","id":1231232,"avatar_url":"https://avatars2.githubusercontent.com/u/1231232?v=4","gravatar_id":"","url":"https://api.github.com/users/jdesboeufs","html_url":"https://github.com/jdesboeufs","followers_url":"https://api.github.com/users/jdesboeufs/followers","following_url":"https://api.github.com/users/jdesboeufs/following{/other_user}","gists_url":"https://api.github.com/users/jdesboeufs/gists{/gist_id}","starred_url":"https://api.github.com/users/jdesboeufs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdesboeufs/subscriptions","organizations_url":"https://api.github.com/users/jdesboeufs/orgs","repos_url":"https://api.github.com/users/jdesboeufs/repos","events_url":"https://api.github.com/users/jdesboeufs/events{/privacy}","received_events_url":"https://api.github.com/users/jdesboeufs/received_events","type":"User","site_admin":false},"created_at":"2018-05-18T07:33:51Z","updated_at":"2018-05-18T07:33:51Z","author_association":"NONE","body":"Same problem with `martinez.union`, through `@turf/union@6.x`."}}
{"actor":{"display_login":"jdesboeufs"}}