Tim Peters <t...@python.org> added the comment:

All right!  So, at a first look, "buffering" isn't an obvious disaster ;-)

I'm afraid nailing anything here is hard.  For example, I don't know what you 
did to "measure memory", but if you're using stats reported by the OS, that's 
fraught with dangers too.  Python's small-object allocator makes only weak 
attempts to return memory "to C", which in turn may or may not return memory to 
"the system".

One way to do better is to call `sys._debugmallocstats()` and stare at the 
output.  The "# bytes in allocated blocks" output line is an exact count of the 
number of bytes pymalloc is currently hanging on to for objects that have been 
allocated but not yet freed.  The point is that C - and the OS - have nothing 
to do with this value.  The downside:  objects > 512 bytes aren't included at 
all in this (pymalloc passes on requests for > 512 bytes to the system 
malloc(), and doesn't keep track of them).

Anyway, so far, so good!  Looks worth pursuing :-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39143>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to