too many open raster files

William L. Baker BakerWL at UWYO.EDU
Fri Dec 20 00:20:52 EST 1996

Any grass programmers still left out there?

I get "WARNING: too many open raster files" after about
20 iterations of a dynamic simulation model that uses
r.mapcalc and other GRASS programs, as well as some
contributed code.  If I omit the following subroutine in
our contributed code, then the program does not produce this
error, so this is the offending code, although other things
going on elsewhere could be contributing other open
raster files (?):

void probascii();


    int fd;
    char *mapset;
    static char prog_name[] = "probascii";
    static char filename[] = "DISTPROB";


    if((mapset = G_find_cell(filename,"")) == NULL) {
      printf("Unable to find file %s.\n",filename);

    if((fd = G_open_cell_old(filename, mapset)) < 0) {
      printf("Unable to open file %s.\n",filename);




I didn't write this code, but I'm trying to debug it.
Anyone see why this fails to close the raster files?
Or, any other clues as to what else could be
producing this WARNING?

Bill Baker

More information about the grass-user mailing list