[Python-ideas] More details in MemoryError

Antoine Pitrou solipsis at pitrou.net
Tue Jan 22 11:50:28 CET 2013


Le Tue, 22 Jan 2013 20:42:38 +1000,
Nick Coghlan <ncoghlan at gmail.com> a
écrit :
> 
> In that case, +0 for at least reporting how much memory was being
> requested for the call that failed, even if that only turns out to be
> useful in our own test suite. -0 for the "currently allocated"
> suggestion though, as I don't see how we can provide a meaningful
> value for that (too much memory usage can be outside of the controller
> of the Python memory allocator, and we don't even track our own usage
> all that closely in non-debug builds).

Windows makes it easy to retrive the current process' memory statistics:
http://hg.python.org/benchmarks/file/43f8a0f5edd3/perf.py#l240

As usual, though, POSIX platforms are stupidly painful to work with:
http://hg.python.org/benchmarks/file/43f8a0f5edd3/perf.py#l202

Regards

Antoine.





More information about the Python-ideas mailing list