What the max size of "Text" in motoko

i have a map like [(Text, Text)] in my motoko backend.
i want to know how big can “Text” store. what the max size can Text store
any where i can test or find those boundary.
also have same question about other type such as " Buffer"

In theory, a single Text can be 2GB or so, but you’ll run into garbage collection limitation at this size.

So the size of a single Text is not limiting; the size of your total live data is more relevant.

During my testing
i call my canister with a size about 2mb. the canister will cause error.
and i got something like “ic0.msg_reply_data_append: application payload size (2621575) cannot be larger than 2097152”

2097152 is equal to 2mb

and i found MAX_INTER_CANISTER_PAYLOAD_IN_BYTES and some variables like max_reply_size here

it seems limited to 2mb rather than 2GB.

can someone explain about those variables.

Ah, but that is unrelated to the max size of Text in Motoko; you are facing the message size limit. But that affects only messages (you can store much more), and is independent of the programming language you are using.

1 Like