[Python-ideas] More details in MemoryError
Nick Coghlan
ncoghlan at gmail.com
Tue Jan 22 11:42:38 CET 2013
On Tue, Jan 22, 2013 at 7:12 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Tue, 22 Jan 2013 18:53:49 +1000,
> Nick Coghlan <ncoghlan at gmail.com> a
> écrit :
>> There's a bigger reason memory error must be stateless: we
>> preallocate and reuse it.
>
> Not anymore, it's a freelist now:
> http://hg.python.org/cpython/file/e8f40d4f497c/Objects/exceptions.c#l2123
>
> The "stateless" part was bogus in Python 3, because of the embedded
> traceback and context.
Oh cool, I forgot about that change.
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).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list