I have a Bayesian simulation package that keeps running into memory allocation problems. I have a feeling this has something to do with Python (2.5.1.1) not freeing memory. The program essentially iterates n times, each time proposing new arrays (numpy) of values that are evaluated using statistical likelihoods. All variables in the loop are re-assigned at each iteration, so there should not be a leak. Nevertheless, at approximately the same iteration every time, I run into malloc errors:
Iteration 36200 at 5647.58165097 Iteration 36300 at 5664.8412981 Iteration 36400 at 5681.71009493 Python(28344,0xa000d000) malloc: *** vm_allocate(size=8421376) failed (error code=3) Python(28344,0xa000d000) malloc: *** error: can't allocate region Python(28344,0xa000d000) malloc: *** set a breakpoint in szone_error to debug Traceback (most recent call last): File "/Users/chris/EURING/detection/detection2.py", line 285, in <module> run() File "/Users/chris/EURING/detection/detection2.py", line 268, in run results = sampler.sample(iterations=iterations, burn=burn, thin=thin) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/PyMC/MCMC.py", line 3021, in sample parameter.propose(debug) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/PyMC/MCMC.py", line 768, in propose if not self._sampler.test(): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/PyMC/MCMC.py", line 2899, in test self() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/PyMC/MCMC.py", line 2562, in __call__ return self.model() File "/Users/chris/EURING/detection/detection2.py", line 238, in model self.pd = invlogit(self.beta0 + self.beta1 * self.wind + self.beta2 * (self.cloud>0) + beta3[self.series- 1]) MemoryError Is there *any* way of getting around this? -- http://mail.python.org/mailman/listinfo/python-list