sys.getsizeof returns an object's shallow memory size in bytes. For containers such as dictionaries, iterators, and lists, that measurement excludes the objects they reference, so it can severely understate the structure's footprint. section 2.4.1
Measuring station data
A dictionary containing station data reports 240 bytes, its values view 40 bytes, and a list of those values 64 bytes. A list holding 17 entries reports 248 bytes, while its first entry contains 1,303,981 characters and reports 10,431,904 bytes. The list size excludes its contents; the character representation adds further memory. section 2.4.1
Interpret measurements by separating container overhead from referenced content:
- Include the sizes of contained objects when estimating a structure rather than treating the container's result as its total footprint. section 2.4.1
- Account for representation costs: entries may be pointers, and character data may be represented by larger Python objects than the underlying file bytes. section 2.4.1
- Use a recursive implementation for many nested objects, but do not assume it captures allocations made inside low-level libraries. section 2.4.1 section 2.4.5

