Re: Checking max_stack_depth automatically

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Checking max_stack_depth automatically
Date: 2006-10-08 15:58:19
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCEA0FC29@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > I have just realized that getrlimit(RLIMIT_STACK) is a
> pretty widely
> > available syscall --- it's specified by the Single Unix
> Spec and the
> > man pages claim it works on all the platforms I have handy to check.
> > I propose that we make use of this call where available to prevent
> > people from setting max_stack_depth larger than, say, the current
> > stack rlimit less half a megabyte.
>
> I've committed changes along this line, and am now wondering
> whether there isn't some equivalent to
> getrlimit(RLIMIT_STACK) on Windows (I somehow doubt that the
> syscall exists as such ;-)). If someone can provide a patch
> to postgres.c's new get_stack_depth_rlimit() function, please do.

It doesn't. It doesn't have the concept of RLIMIT, really.
In "the old days", there was on way to limit how much memory a process
uses. In Windows 2000, "Job Objects" were added, which can limit them.
But they make no difference between stack and non-stack memory.

For win32, we set the stacksize in src/backend/Makefile with
"-Wl,--stack=4194304". So we know at build time what it is, if that
helps you...

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2006-10-08 16:26:18 Re: PL/pgSQL Todo, better information in errcontext from plpgsql
Previous Message Magnus Hagander 2006-10-08 15:53:55 Re: 8.2beta1 crash possibly in libpq