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";

    G_gisinit(prog_name);

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

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

   ...CODE OMITTED

    G_close_cell(fd);

  }

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
BAKERWL at UWYO.EDU




More information about the grass-user mailing list