Comments (7)
Do you have a reproducible case we can test with here? We did have an earlier memory issue we believe to be fixed, around polyfill
. On the Emscripten size, there's a fixed memory limit, so I believe running a bad case repeatedly should eventually error out with Emscripten's version of OOM - so all we need is an example of something bad that we can run millions of times.
from h3-js.
Ok, here is an exemple of an isochrone that rises the issue.
Of course, there is always the possibility that I don't use this library as I should...
const isochron = require('./isochrones.json');
for (let i = 0 ; i < 5000; i++){
isochron.features[0].geometry.coordinates.forEach((singlePolygon) => {
let xxx = h3.polyfill(singlePolygon, 9, false)
xxx = null;
})
}
Worth mentioning:
node: 12.16.1
h3-js: 3.7.1
from h3-js.
OK, I can take a look. Does this give you an OOM error? or do you just see the memory rising in system monitors?
from h3-js.
Both, memory is rising and depending on how much memory is given to node, eventually you will get an OOM error.
from h3-js.
OK, but currently this is a Node OOM, not an Emscripten OOM. That's interesting, Emscripten has a dedicated amount of memory for its internal "heap" and should throw its own OOM error well before Node runs out of memory. That suggests this might be on the JS side. I can try to do some tests today.
from h3-js.
I am not able to repro this. I ran the code above and charted the memory output using process.memoryUsage()
. I see the expected sawtooth - memory ramping up, then getting garbage collected and going down. The bottom of the graph seems to stay pretty stable at 4-5Mb.
[4999] memoryUsage: 17777 / 38568 kB | max 20590 kB
20590.00 ┤ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮ ╭╮
17989.67 ┤ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭╮ ╭╮ ││ ╭╮││ ╭
15389.33 ┤╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ ││ ╭╮││ ╭╮││ ││││ │
12789.00 ┤│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮││ │││╰╮│││╰╮│││╰╮│
10188.67 ┤│╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││╰╮│╰╯ ││╰╯ ││╰╯ ││
7588.33 ┤│ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯ ││ ││ ╰╯ ╰╯
4988.00 ┼╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯ ╰╯
This shows high memory usage, but I don't see a leak, and I went over the code and don't see leak suspects (though this is a particularly hairy part of the code w/r/t memory management). I used Node v14.16.1
.
What Node version are you using? And does the isolated example above throw an OOM for you? We're definitely using a lot of memory here, and you could likely reduce it by e.g. splitting up the polygons or using a coarser hex and then uncompacting it to a finer resolution, but I'm not sure I see a leak.
from h3-js.
Closing as I was never able to repro. Please reopen if there's a repeatable scenario.
from h3-js.
Related Issues (20)
- some h3index values create distorted long horizontal line on map HOT 1
- compactCells throws error HOT 1
- Openlayers instead of Mapbox HOT 1
- Count the number of points in the aggregated bins of H3-hexagons HOT 3
- Upgrade emscripten to 3.X.X? HOT 7
- Integrating with google maps HOT 1
- How to replace firestore geofire with h3? HOT 3
- Potential memory leak in polygonToCells HOT 10
- Load and Display H3-JS binned dataset in Mapbox HOT 1
- Consider buffer radius in addition to H3 resolution when counting points in the aggregated bins of H3-hexagons HOT 2
- Inverted coordinates HOT 1
- H3-JS binning resoluion in OpenLayers HOT 1
- Incorrect result from polygonToCells for bigger screen/ higher dimensions HOT 6
- Error when passing zero area polygon to h3.polygonToCells HOT 2
- Does h3-js send any data to the server? HOT 1
- I am unable to load h3-JS in my quasar project HOT 3
- H3 with dynamodb
- Different output from h3-js and postgis using cellToBoundary function HOT 1
- Hexagons Resolution HOT 1
- Somthing is funky at the borders of the cells HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3-js.