Hacker News new | ask | show | jobs
by Someone 58 days ago
So, Python tries to outsmart the system’s malloc. Isn’t there a risk there that the two interact in unexpected ways?

For example, it seems a realloc of an object that is larger than 512 bytes to a size smaller than 512 bytes may allocate a megabyte of memory (https://docs.python.org/3/c-api/memory.html#the-pymalloc-all...: “Python has a pymalloc allocator optimized for small objects (smaller or equal to 512 bytes) with a short lifetime. It uses memory mappings called “arenas” with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit platforms“