Help me understand rts_memory_size() and canister size?

Help me understand what is the size value in bytes that we’re getting back by using Prim.rts_memory_size() function? I’ve played around uploading a file to container that uses chunking / streaming for files larger than 2MB. Now, I have made a simple method in that container to return the current container size by using the above Prim.rts_memory_size() method. The thing I am trying to understand is:

  • I upload a file which is 2.7mb in size (the size of the canister prior to this was 38010880 (36.25mb) as returned by the rts_memory_size() method.
  • The size of the canister after upload of the above mentioned file is now 55574528 (or 53mb)

This seems like a very big increase in canister size (17mb approx) for just a 2.7mb file upload. Also… is there a way to know what the canister size would be after uploading a new file to it (before we do it), or adding more data to it?

1 Like