malloc (error code=12)
rogerb at rogerbinns.com
Thu Jan 22 04:01:27 CET 2009
-----BEGIN PGP SIGNED MESSAGE-----
Arash Arfaee wrote:
> Python(15492,0xb0103000) malloc: *** mmap(size=393216) failed (error
errno 12 is ENOMEM on Macs (and Linux for that matter). You may have
run out of swap space, but that is unlikely.
The most likely cause is that you have run out of address space. For
example a 32 bit process has 4GB of address space available. The kernel
will take up to 2GB of that depending on the operating system. Various
shared libraries and your program will take some. The program stack
space will take some more.
In your case malloc is attempting to allocate 384kb of memory using mmap
by mapping anonymous memory (swap) into the address space. (The
advantage of doing it this way is that the space can be unmapped when no
With no appropriate address space left for this chunk, you get the
error. You are either trying to use too much stuff or there is a memory
leak. Calling gc.collect() can result in some deferred items being freed.
To get an idea of how address space works, check out this article about
what Linux did in 2004. The same principles apply to MacOSX. You can
also see how the theoretical 4GB quickly disappears!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Python-list