Using getsizeof () built-in function we can calculate memory used by an object. The standard library’s sys module provides the getsizeof () function. The sys.getsizeof () function return the size of an object in bytes.
Syntax : sys.getsizeof(object[, default])
Example: