[Python-Dev] MemoryError... how much memory?

Benjamin Peterson benjamin at python.org
Wed Oct 27 17:05:23 CEST 2010


2010/10/27 Facundo Batista <facundobatista at gmail.com>:
> There are a lot of places where Python or modules do something like:
>
>    self->buf = (char *)malloc(size);
>    if (!self->buf) {
>              PyErr_SetString(PyExc_MemoryError, "out of memory");
>
> At job, we're having some MemoryErrors, and one thing that we would
> love to know, if how much memory it was asking when that happened.

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?

Also, why is that useful?



-- 
Regards,
Benjamin


More information about the Python-Dev mailing list