Wrong Memory Calculation

I tested a bunch of code to see the memory consumption and found that CodeChef’s memory calculation is different and way too weird.
Sample Code

import sys
# A string variable of size approximately 488 + MB
ran_str = " " * 512000000

# Print the size
print(sys.getsizeof(ran_str) /1024 / 1024 ) # getsizeof() returns size on bytes.

This code shows memory consumption in KB(s), which has blown my mind as to how in the world it can be as the variable itself is defined to consume MB(s).


@cyberl0rd - getting it checked. Will revert to you by tomorrow.

1 Like

Hi @cyberl0rd

Thank you for pointing this out. The unit used was incorrectly shown in kB whereas it should be in MB. This will be fixed in a couple of days.