Unused buffer allocated with physical memory in io.BufferedReader.read()
io.BufferedReader.read(n)
allocates a memoryview of size n
and passes it on to the underlying io object's .readinto()
. However, n
can be larger than the size of the returned data, which causes the rest of the memory to be wasted. This isn't an issue on CPython, because the allocation stays in virtual memory. OTOH, pypy allocates physical memory, which can cause drastically worse performance in bad cases.