Is there any document about the amount of memory occupied by the basic types of Motoko canister?

  • Nat32, Char: 8 bytes
  • Int64: 12 bytes
  • Nat and Int: “free” if smaller than 2^30, else at least 20 bytes, up to arbitrary sizes
  • Text and Blob: up to 8+n+3 bytes.
  • opt: “free” unless you deal with the value ?…?null
  • List is not a basic type. Probably 12*n

Free means that it’s stored inside the containing data structure without extra allocation.

6 Likes