Thread: [GENERAL] ShmemAlloc maximum size

[GENERAL] ShmemAlloc maximum size

From
"hari.prasath"
Date:
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.? 



cheers
- Harry

Re: [GENERAL] ShmemAlloc maximum size

From
Melvin Davidson
Date:


On Thu, Feb 23, 2017 at 9:47 AM, hari.prasath <hari.prasath@zohocorp.com> 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.? 



cheers
- Harry


>Am i missing something.?
Probably. Perhaps if you told us the exact version of PostgreSQL & O/S, it might be more helpful.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: [GENERAL] ShmemAlloc maximum size

From
"hari.prasath"
Date:
Tried in 9.5 and 9.6 version if postgresql. 

OS: mac sierra 16gb RAM

cheers
- Harry


---- On Thu, 23 Feb 2017 20:27:58 +0530 Melvin Davidson<melvin6925@gmail.com> wrote ----



On Thu, Feb 23, 2017 at 9:47 AM, hari.prasath <hari.prasath@zohocorp.com> 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.? 



cheers
- Harry


>Am i missing something.?
Probably. Perhaps if you told us the exact version of PostgreSQL & O/S, it might be more helpful.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: [GENERAL] ShmemAlloc maximum size

From
Julien Rouhaud
Date:
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