What is included in 'Memory Size' reported by dfx canister status?

What is included in the Memory Size reported by the dfx canister status command?

% dfx canister status <..canister_id..>
...
Memory Size: Nat(1199042541)
...

Is it the sum of stack + Orthogonal_Persisted + Stable ?


Another , related question, is how I can check what the wasm memory is. That piece of the memory that counts towards the limit of 3 Gb.

1 Like

The memory size includes execution memory (heap, stable, globals, Wasm), canister history memory, wasm chunk storage and snapshots that belong to this canister.

2 Likes

At the moment, the WASM memory size is not exposed directly: one could only get close by estimating and subtracting the remaining parts of the canister memory usage defined above (note that Wasm is counted as the size of the raw size of the wasm module plus the total size of the uncompressed wasm module’s custom sections). However, we’re discussing exposing such limits through a synchronous system API called by the canister.

1 Like

What do globals and Wasm refer to exactly here? Does Wasm include the binary size? Does it include the total Wasm memory, including the stack?

The canister memory size includes:

  • execution state memory usage - wasm memory (heap) usage, stable memory usage, global memory usage (linear in the number of exported globals), (compressed) wasm binary size, and wasm custom sections size;
  • canister history memory usage;
  • wasm chunk store memory usage;
  • canister snapshots memory usage.
1 Like