Finding size of Variable

Ayushi Dalmia ayushidalmia2604 at
Tue Feb 4 12:28:33 CET 2014


I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't gives the actual value of the memory occupied. 

For example, if a file in my file system occupies 4 KB of data, if I read all the lines in a list, the size of the list is around 2100 bytes only.

Where am I going wrong? What are the alternatives I can try?

More information about the Python-list mailing list