[GRASS-user] g.mremove error: "Argument list too long"

Glynn Clements glynn at gclements.plus.com
Mon Oct 6 05:38:27 EDT 2008


Markus Neteler wrote:

> On Wed, Sep 24, 2008 at 5:04 PM, Daniel Victoria
> <daniel.victoria at gmail.com> wrote:
> > I've bumped into this problem before, with the same error, but outside
> > GRASS. Which shows that this is not a GRASS bug but a limitation of
> > the operating system.
> 
> AFAIK, to find the limit, you can run (file is from glibc-devel):
> 
> grep ARG_MAX /usr/include/linux/limits.h
> #define ARG_MAX       131072    /* # bytes of args + environ for exec() */

It's more robust to use sysconf(_SC_ARG_MAX), as the limit isn't
necessarily fixed at compile time (e.g. it can vary between kernel
versions).

Also, the limit is divided between argv[] and the environment. If you
have a lot of space taken up by environment variables, it will eat
into the space available. This can be significant on older systems,
where the limit may be as low as 4KiB (a single page of memory).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list