# List.chunks trap with few data's

**URL:** <https://forum.dfinity.org/t/list-chunks-trap-with-few-datas/14509>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [July 24, 2022, 12:21pm UTC](https://forum.dfinity.org/t/list-chunks-trap-with-few-datas/14509 "2022-07-24T12:21:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbolog](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbolog/32/239_2.png) [@rbolog](https://forum.dfinity.org/u/rbolog)\
**Post date:** [July 24, 2022, 12:21pm UTC](https://forum.dfinity.org/t/list-chunks-trap-with-few-datas/14509/1 "2022-07-24T12:21:48Z")

</div>

Hi,

I wanted to use the List.chunks method from a Buffer data source. I realise that quite quickly a little over 1MB there is a “trapped: stack overflow” exception.

Either I’m misusing it or I finally find that the limit is very low.

What do you think about this?

Code example:

```auto
// Method to append data to buffer
public func appendToBuffer(number : Nat, value : Nat8) : async Nat {
    for (i in Iter.range(1,number)) {
      dataBuf.add(value);
    };
    return dataBuf.size();
  };
 
// chunks data by 16 bytes
  public func makeStripes() : async Nat {
    stripes := List.chunks(16,List.fromArray(dataBuf.toArray()));
    dataBuf.clear();
    return List.size(stripes);
  };

```

Full test:

[Playground sample](https://m7sm4-2iaaa-aaaab-qabra-cai.raw.ic0.app/?tag=45093080)

---

<div class="post-metadata">

**Author:** ![rbolog](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbolog/32/239_2.png) [@rbolog](https://forum.dfinity.org/u/rbolog)\
**Post date:** [July 26, 2022, 4:24pm UTC](https://forum.dfinity.org/t/list-chunks-trap-with-few-datas/14509/2 "2022-07-26T16:24:38Z")

</div>

I open an issue

[Issue in dfinity / motoko-base](https://github.com/dfinity/motoko-base/issues/407)
