On Thu, Oct 28, 2010 at 8:00 AM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Facundo Batista <facundobati...@gmail.com> writes: > >> On Wed, Oct 27, 2010 at 12:05 PM, Benjamin Peterson <benja...@python.org> >> wrote: >> >> > Isn't this usually when you do something like [None]*2**300? In that >> > case, wouldn't you know how much memory you're requesting? >> >> It could happen on any malloc. It depends on how much you have free. > > It also depends on how much is being requested. The caller knows that > amount, surely?
For a server process, the MemoryError in the log won't always have the context information showing what the values were in the calling frames. The idea behind Facundo's request is similar to the reason why we print the type names in a lot of TypeErrors. If you see MemoryError (5 bytes), the things you go looking for are very different from those you look for when you see MemoryError(1 gajillion bytes). (i.e. for the former, you look for a memory or other resource leak, for the latter, you look for the reason your code is trying to get 1 gajillion bytes from the OS). If a long-lived server isn't crashing but is still getting MemoryError occasionally, problems with specific oversized requests are much more likely than a general resource leak (as those usually bring the whole process down eventually). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com