You might be able to move to 64 bit... you'll need to ensure you are
running 64 bit Ubuntu, and that GRASS is compiled in 64 bit mode too.
Although I think gcc (the compiler) should automatically compile in 64
bits if you are in a 64 bit OS.
If that doesn't make a difference, it might be worth checking the
mailing list archives etc. to see if GRASS supports 64 bit memory
allocation (it should, but you never know...), if it doesn't you could
directly use the raw malloc/realloc() functions.
Another option is to modify the code to obtain the memory it needs
immediately instead of reallocating memory (which is what G_realloc()
does) when too many dispersal events are created. Reallocating memory
(e.g. trying to get bigger sections of free memory) can result in
fragmentation, so even if there is 2 Gb of memory available, if it's
not in a contiguous block then you might get an out of memory error.
> The other thing I was thinking, if that doesn't work, would be to try and
> separate the writing of the existing_counter (those dispersal events that
> don't leave their cell of origin) from the writing of the jumps_count (those
> that do) in the r.mdig.kernel utility, and then combine them in grass using
> a mapcalc command.
Yes, you could make it get the maximum memory available, and if there
is too many events, it could write a temporary map and flush the
memory. Then at the end it could sum these maps with mapcalc.
> The other option is to try and scale back the simulations, but of course
> that isn't ideal. Let me know if you have any insight.
How many events are you generating out of curiousity? It's worth
determining whether it's just large, or if it's computationally
impractical, before spending too much time on it ;-)
Cheers
J