# Seems to be a memory leak

**URL:** <https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354>\
**Category:** Dgraph\
**Tags:** status:accepted, ticket:created\
**Created:** [September 14, 2020, 5:50pm UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354 "2020-09-14T17:50:30Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [September 21, 2020, 9:58pm UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/23 "2020-09-21T21:58:07Z")

</div>

Need a lot more details here: logs, heap profile and so on.

---

<div class="post-metadata">

**Author:** ![martinmr](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martinmr/32/1408_2.png) [@martinmr](https://discuss.dgraph.io/u/martinmr)\
**Post date:** [September 23, 2020, 12:50am UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/24 "2020-09-23T00:50:57Z")

</div>

I don’t understand your question. Can you rephrase?

We are working on reducing the memory needed to store the map that is causing this issue. Best bet for now is to try smaller mutations rather than change `snapshot_after`.

---

<div class="post-metadata">

**Author:** ![mbande](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mbande/32/5243_2.png) [@mbande](https://discuss.dgraph.io/u/mbande)\
**Post date:** [September 28, 2020, 7:26am UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/25 "2020-09-28T07:26:30Z")

</div>

@martinmr as you mentioned “Change the value of `--snapshot_after` to a smaller value so that the map is cleared more often”, i changed that value to 1000, and i expect that after 1000 mutations, the memory usage fall down, but i don’t see any evidence of effectiveness of that parameter.

---

<div class="post-metadata">

**Author:** ![mbande](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mbande/32/5243_2.png) [@mbande](https://discuss.dgraph.io/u/mbande)\
**Post date:** [September 28, 2020, 7:28am UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/26 "2020-09-28T07:28:41Z")

</div>

also, smaller mutations is not an option for me, because that will cause more mutations, which will reduce the overall speed of data import.

---

<div class="post-metadata">

**Author:** ![mbande](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mbande/32/5243_2.png) [@mbande](https://discuss.dgraph.io/u/mbande)\
**Post date:** [September 28, 2020, 7:32am UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/27 "2020-09-28T07:32:52Z")

</div>

@mrjn as Martin mentioned “we have enough info on our side”, do you need more details yet? if so, it can take some time for me to learn how to gather heap profile and so on, but i can try it.

---

<div class="post-metadata">

**Author:** ![martinmr](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martinmr/32/1408_2.png) [@martinmr](https://discuss.dgraph.io/u/martinmr)\
**Post date:** [September 28, 2020, 5:10pm UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/28 "2020-09-28T17:10:02Z")

</div>

@mrjn. I think we have enough details on our side for now. The mutations @mbande is running are pretty simple and I was able to reproduce the same issue. It looks like the mmap-based keyCommit map should help with this. Is someone working on that? Last time I heard @ashishgoswami was working on that. is that right?

@mbande I thought changing the `--snapshot_after` parameter could help but it looks like it doesn’t have much effect. Not sure of a workaround if smaller mutations are not doable. Maybe restarting zero once in a while to reset the memory would help? The change we are working on should help but it requires a code change and a new minor release.

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [September 29, 2020, 12:07am UTC](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354/29 "2020-09-29T00:07:48Z")

</div>

> [@martinmr](#):
>
> Last time I heard @ashishgoswami was working on that. is that right?

That’s right. He’s working on it.

[Previous page](https://discuss.dgraph.io/t/seems-to-be-a-memory-leak/10354.md?page=1)
