Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to run r.sim.water on a 3 meter LiDAR-generated DEM I have, but keep getting G_malloc errors:

r.sim.water --verbose dxin=centDEM.dx@Sediment_Simulation dyin=centDEM.dy@Sediment_Simulation depth=sim.water.depth disch=sim.water.discharge err=sim.water.error nwalk=1000

My error message:

ERROR: G_malloc: unable to allocate 43608 bytes at main.c:488

I'm running GRASS 6.4.2 on Windows. I've tried using a Ubuntu install on VirtualBox, and it fails out without any error at all. I tried ratcheting down the number of walkers (hence nwalk=1000), but that doesn't seem to help. I can't really think of what to try next.

share|improve this question
up vote 1 down vote accepted

I suspect that your raster resolution and/or your computational region is too large. Check the output of "g.region -p" (in the menu Settings -> Region -> Display Region) to see how many raster cells you want to calculate. It likely exceeds the resources of the computer you are working with, at least that is commonly the problem.

Solution: set the computational region correctly.

share|improve this answer
I suspected as much. Am I missing something that indicates the max region size this tool can operate on (given a certain amount of available ram)? I know the region is too large to run r.watershed in memory, but there is a flag to use virtual memory; I don't suppose there's anything like that for r.sim.water? – Nat Apr 24 '12 at 16:23
Perhaps 2GB is the limit if you have a 32bit machine. How many columns do you have in the "g.region -p" output? – markusN Apr 24 '12 at 20:48
5451 columns, 6864 rows. I'm certain you're right about the memory; I'm going to try it again after downsampling the DEM to a different mapset, and accept your answer. – Nat Apr 26 '12 at 13:29
Glad you found it. FYI, for downsampling methods, see… – markusN Apr 29 '12 at 18:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.