Answers for "how to get memory usage of a variable in poython"

1

python how much memory does a variable need

from sys import getsizeof
a = 42
getsizeof(a) # size of object in bytes
Posted by: Guest on May-18-2021
1

python memory usage

import sys 
variable = 30 
print(sys.getsizeof(variable)) # 24
Posted by: Guest on February-16-2021

Code answers related to "how to get memory usage of a variable in poython"

Python Answers by Framework

Browse Popular Code Answers by Language