List.chunks trap with few data's

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:

// 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

I open an issue

Issue in dfinity / motoko-base