# Not enough memory error

**URL:** <https://ask.openrouteservice.org/t/not-enough-memory-error/1670>\
**Category:** openrouteservice\
**Created:** [May 6, 2020, 5:14pm UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670 "2020-05-06T17:14:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![caduguedess](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/caduguedess/32/510_2.png) [@caduguedess](https://ask.openrouteservice.org/u/caduguedess)\
**Post date:** [May 6, 2020, 5:14pm UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/1 "2020-05-06T17:14:26Z")

</div>

Greetings,

After sucessfully setting up a ORS backend using the OSM file of south of Brazil (200 MB), I tried to do with the whole Brazil country (1 GB) but localhost:8080/ors/health got stuck in “not ready” and the ors.log returned some memory errors.

> <https://gist.github.com/caduguedess/003f98fe5e4f00a4bb5ab48c122ced5e>

Here follows my docker-compose.yml, I did set both Xms and Xmx to 8g (way more than the 2\*PBF size suggested)

> <https://gist.github.com/caduguedess/50f7a548507854d75da9bd4afa48b849>

I only left “vehicles-car” profile active in app.config.sample to reduce memory usage.  
The laptop is running Ubuntu 18.04 with 16 GB RAM.  
I appreciate any suggestion for addressing this issue.  
If any other file or log is needed please ask me so I can update the post.

Best regards.

---

<div class="post-metadata">

**Author:** ![adam](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/adam/32/8_2.png) [@adam](https://ask.openrouteservice.org/u/adam)\
**Post date:** [May 7, 2020, 5:56am UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/2 "2020-05-07T05:56:03Z")

</div>

I think this is likely because though the pbf size is small for south america, the geographical context is a lot bigger so there is quite a bit of elevation data that would be loaded aswell. The bit that it is failing on is in the landmark processing, and so what I expect is happening is that because the number of threads for preparing is set to 8, having both shortest and fastest calculations happening at the same time is too much. Try doing it again but in the following:

```auto
"lm":{
  "enabled":true,
  "threads":8,
  "weightings":"fastest,shortest",
  "landmarks":24
}

```

change `"threads": 8,` to be `"threads": 1,`

---

<div class="post-metadata">

**Author:** ![adam](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/adam/32/8_2.png) [@adam](https://ask.openrouteservice.org/u/adam)\
**Post date:** [May 7, 2020, 5:57am UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/3 "2020-05-07T05:57:04Z")

</div>

Also you can try changing the value for landmarks as we have payed around with that here and found that 16 is pretty much as good as 24, whilst saving quite a lot of RAM

---

<div class="post-metadata">

**Author:** ![caduguedess](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/caduguedess/32/510_2.png) [@caduguedess](https://ask.openrouteservice.org/u/caduguedess)\
**Post date:** [May 7, 2020, 3:12pm UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/4 "2020-05-07T15:12:02Z")

</div>

Hi @adam

Thanks for the suggestions.  
I will test your suggestions in this order:

1. setting threads to 1;
2. setting landmarks to 16;
3. deleting shortest weightings.

I will post the results when an option works or after the last suggestion fails.

Best regards.

---

<div class="post-metadata">

**Author:** ![caduguedess](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/caduguedess/32/510_2.png) [@caduguedess](https://ask.openrouteservice.org/u/caduguedess)\
**Post date:** [May 7, 2020, 8:25pm UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/5 "2020-05-07T20:25:45Z")

</div>

Hi @adam

Setting threads to 1 still caused the same error, stuck for about 2 hours in not ready.  
After setting landmarks to 16 it finally went to “ready” status in 30 minutes.  
Thank you.

Best regards.

---

<div class="post-metadata">

**Author:** ![peter](https://ask.openrouteservice.org/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@peter](https://ask.openrouteservice.org/u/peter)\
**Post date:** [May 8, 2020, 5:12pm UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/6 "2020-05-08T17:12:55Z")

</div>

Hi All,

We changed the configuration to the following but still have the same error. In our case the pbf file is 2G. We set the Xms20g already. From other posts it seems there is a bug in the release. Any other suggestions to fix the issue?

1. setting threads to 1;
2. setting landmarks to 16;
3. deleting shortest weightings.

Caused by: java.lang.OutOfMemoryError: Java heap space  
ors-app | at com.carrotsearch.hppc.IntObjectHashMap.allocateBuffers(IntObjectHashMap.java:1103) ~[hppc-0.8.1.jar:?]  
ors-app | at com.carrotsearch.hppc.IntObjectHashMap.allocateThenInsertThenRehash(IntObjectHashMap.java:1136) ~[hppc-0.8.1.jar:?]  
ors-app | at com.carrotsearch.hppc.IntObjectHashMap.put(IntObjectHashMap.java:180) ~[hppc-0.8.1.jar:?]  
ors-app | at com.graphhopper.routing.AbstractBidirAlgo.fillEdges(AbstractBidirAlgo.java:315) ~[graphhopper-core-v0.13.2.jar:?]  
ors-app | at com.graphhopper.routing.AbstractBidirAlgo.fillEdgesFrom(AbstractBidirAlgo.java:274) ~[graphhopper-core-v0.13.2.jar:?]  
ors-app | at com.graphhopper.routing.AbstractBidirAlgo.runAlgo(AbstractBidirAlgo.java:238) ~[graphhopper-core-v0.13.2.jar:?]  
ors-app | at com.graphhopper.routing.lm.LandmarkStorage$LandmarkExplorer.runAlgo(LandmarkStorage.java:814) ~[graphhopper-core-v0.13.2  
.jar:?]

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [May 11, 2020, 9:19am UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/7 "2020-05-11T09:19:49Z")

</div>

Hi @peter,

sorry, that was my bad. The `app.config` wasn’t mirrored properly in the container.

You can try my branch [`fix-docker`](https://github.com/GIScience/openrouteservice/tree/fix-docker/docker), which should get you up and running. You’ll have to rebuild the image though.

Or you wait a few days (or maybe only hours) until it’s merged to `master`, then it should be usable from Dockerhub as well.

---

<div class="post-metadata">

**Author:** ![peter](https://ask.openrouteservice.org/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@peter](https://ask.openrouteservice.org/u/peter)\
**Post date:** [May 14, 2020, 12:46am UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/8 "2020-05-14T00:46:07Z")

</div>

Hi @nils

Is the fix merged to master? If we clone the whole package will it work now?

Peter

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [May 20, 2020, 5:53am UTC](https://ask.openrouteservice.org/t/not-enough-memory-error/1670/9 "2020-05-20T05:53:55Z")

</div>

sorry for the late reply, just seeing this.

it’s merged since yesterday. give it a spin and ideally report back.
