[Pythonmac-SIG] memory allocation issue

Chris Fonnesbeck fonnesbeck at gmail.com
Sat Jul 30 16:27:56 CEST 2005


I have a Bayesian simulation package, PyMC, that I run on OSX 10.4
using either Python 2.3.5 or the ActiveState 2.4. It essentially
generates long sample arrays of parameter values, which it then
summarizes at the end (I am using Numeric arrays). However, after a
simulation of only 80K iterations (for about 7 parameters), I start
running into memory allocation problems:

python(22156,0xa000ef98) malloc: *** vm_allocate(size=1400324096)
failed (error code=3)
python(22156,0xa000ef98) malloc: *** error: can't allocate region
python(22156,0xa000ef98) malloc: *** set a breakpoint in szone_error to debug
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyMC/MCMC.py",
line 1768, in sample
    except KeyboardInterrupt:
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyMC/MCMC.py",
line 1286, in summary
    }
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyMC/MCMC.py",
line 260, in get_trace
    return array([x for i, x in enumerate(self._trace[start:end])])
MemoryError: can't allocate memory for array

This doesnt seem like a lot of data, so I am wondering what the
problem might be. Should I be using numarray instead -- it sounds like
I would take a performance hit if I did. Any guidance here would be
most helpful.

Thanks,
Chris


More information about the Pythonmac-SIG mailing list