# Heap out of bounds ， use motoko

**URL:** <https://forum.dfinity.org/t/heap-out-of-bounds-use-motoko/10497>\
**Category:** Developers\
**Tags:** Functional-Programming\
**Created:** [January 26, 2022, 9:23am UTC](https://forum.dfinity.org/t/heap-out-of-bounds-use-motoko/10497 "2022-01-26T09:23:59Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![claudio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/claudio/32/322_2.png) [@claudio](https://forum.dfinity.org/u/claudio)\
**Post date:** [June 22, 2023, 10:41am UTC](https://forum.dfinity.org/t/heap-out-of-bounds-use-motoko/10497/44 "2023-06-22T10:41:37Z")

</div>

So the introduction of [var \_] as you did should improve sharing, but I think if its failing with a stack overflow then it might be the use of deeply nested recursive value (of type Entry) that might be the other problem. Reading the code and this, [Map v8.0.0, it's finally here](https://forum.dfinity.org/t/map-v8-0-0-its-finally-here/18962), I wonder if it’s the support for the previous and next pointers,preserving insertion order, that (I guess) are linking all entries in a long list.

Just a hunch, I’m afraid. Could you record the hashes of previous and next entries instead and link them that way?

---

_[View the full topic](https://forum.dfinity.org/t/heap-out-of-bounds-use-motoko/10497)._
