I tried to use r.watershed function in GRASS GIS, and got an error message ERROR: G_malloc: unable to allocate 3837384596 bytes of memory at raster/r.watershed/ram/init_vars.c:146 before getting the outputs. Because I am not sure what caused this, so I would describe my situation from the beginning.
- GRASS GIS 7.0.4 was installed by installing OSGeo4W package. (under Win 10, 64-bit, x64, RAM = 8 GB)
- I created location 'nl' using GRASS GUI
- set the EPSG code based on the actual location of the map I would load to GRASS GIS later
- Then I set the extent and resolution of the location. (I loaded the map (later to be loaded in GRASS) to QGIS, and used the 'save as...' to check the extent of this map, and set the extent based on the information from QGIS.) But I didn't change the setting of resolution, just left them as default.
- I created the mapset 'nl'
- In 'nl' mapset, I used
r.importto load the raster map, although there were some warnings, the result looked fine.
r.import input=C:\Users\Heinz\Desktop\GRASStest\hc.tif output=hc WARNING: Datum <unknown> not recognised by GRASS and no parameters found WARNING: Datum <unknown> not recognised by GRASS and no parameters found WARNING: Datum <unknown> not recognised by GRASS and no parameters found Proceeding with import of 1 raster bands... Importing raster map <hc>...
- I used r.watershed, but the error message occurred:
r.watershed elevation=hc@nl threshold=5000 accumulation=acc drainage=dra basin=bas stream=str
SECTION 1a (of 5): Initiating Memory.
Current region rows: 57567, cols: 53957
ERROR: G_malloc: unable to allocate 3837384596 bytes of memory at raster/r.watershed/ram/init_vars.c:146
WARNING: Subprocess failed with exit code 1
WARNING: category information for [acc] in [nl] missing or invalid
WARNING: category information for [dra] in [nl] missing or invalid
WARNING: category information for [bas] in [nl] missing or invalid
WARNING: category information for [str] in [nl] missing or invalid
I don't know what stage-setting causing this error, and how to solve this error.
I installed GRASS GIS 7.0.5 through OSGeo4W 64bit installer (under Win 10, 64-bit, x64, RAM = 8 GB), and ran
r.watershed with the same raster file loaded into the mapset, but got the same error message I posted above.
It's weird because I successfully ran
r.watershed on the same notebook before, just with GRASS GIS version 6. (This NB had been reformatted once.)
The result of
Besides, as I launched GRASS GIS GUI, some error messages showed up:
I am wondering if these errors in relation to the error message showed as I ran
r.watershed, and I have checked that under C:\OSGeo4W64\apps\Python27\Lib\site-packages I got numpy installed.