Re: ShmemAlloc maximum size

From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: "hari(dot)prasath" <hari(dot)prasath(at)zohocorp(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ShmemAlloc maximum size
Date: 2017-02-23 19:55:19
Message-ID: 20170223195519.GA10384@nol.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 23, 2017 at 08:17:54PM +0530, hari.prasath wrote:
> I am trying to get some 15MB of shared memory using ShmemAlloc.
>
> Cross checked all my kernal variables set in OS level and also in postgresql.conf.
>
> Cant able to get the required memory(15MB) but if i try with some small memory(1MB), its working fine.
>
> Am i missing something.?

Assuming you're talking about some C extension, you have to request in
_PG_INIT() the amount of shmem you'll need, with RequestAddinShmemSpace().

You can see an example in pg_stat_statements.c how it's done (_PG_INIT() and
pgss_shmem_startup()).

Asking a small amount probably works because some shared memory is requested
but not totally used as soon as the server starts.

Regards.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Moreno Andreo 2017-02-24 15:36:48 echo
Previous Message Sandeep Thakkar 2017-02-23 17:42:07 Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?