Python Lists vs. C Arrays: Up to 7x Memory for Numerical Data

Python lists store pointers to objects, adding an 8-byte overhead per element on 64-bit systems, alongside each object's own overhead, making them significantly less memory-efficient than contiguous C arrays that store raw data directly. For a million integers, a Python list might use ~28 MB, while a NumPy array (similar to a C array) uses ~4 MB.

Sources

Open the full topic