I explored and found sys.getsizeof()
to get the size of an object, but it is giving the same size for below objects:
import sys
>>> obj = MyModel.objects.first()
>>> sys.getsizeof(obj)
64
>>> obj.description = 'abcdefghi....xyz' # entered a very long string here
>>> sys.getsizeof(obj)
64
No matter which model objects I use, the size is always 64, even if the object contains too many fields.
What am I doing wrong, and how to get the actual size of an object in bytes?
Edit: Some of you are suggesting this question How do I determine the size of an object in Python?, but it says to use sys.getsizeof()
function, which is giving me unexpected result. PS. I am new to django and python