The memory size includes execution memory (heap, stable, globals, Wasm), canister history memory, wasm chunk storage and snapshots that belong to this canister.
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.