On Wed, Jun 6, 2012 at 9:36 AM, lorenzo
<sitbot@gmail.com> wrote:
I try to run my python program with a large matrix image.
Unfortunately I receive an memory error. Here the program (that run in
window PC) that donot crash with image represented by matrix 3000 x
3000. With 7000 x 7000 do not works.
Even increasinf the virtual memory the problem still remain.
best reg Lorenzo Bottai
Hi Lorenzo,
How much memory does your system have?
Also, where does the error get raised? It looks like the watershed function may create a few temporary arrays of the same size as the input image.
In any case, it looks like you're creating both 32-bit and 64-bit images that are 7000 x 7000, so each image will be ~200 to 400 MB. From a quick glance of your code, I don't really know how many images you're creating (I'm not familiar with the packages you're using), but there seem to be enough of them to cause a memory error (depending on your system specs).
Have you tried reordering the code so that you only allocate arrays at the last minute and manually delete arrays right after you're done with them? There may be more robust techniques, like memory-mapped arrays, but I'm not too familiar with them.
-Tony