The sys.getsizeof()
function returns the size of an object in memory, in bytes. As this function may return inaccurate results for third-party objects, how do I determine how much memory a BioPython object is using?
I loaded a 286MB file using example code (modified):
from Bio import SeqIO
handle = open("example.gb", "rU")
records = list(SeqIO.parse(handle, "genbank"))
handle.close()
and sys.getsizeof(records)
indicates that it is using 268KB.