From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jack Orenstein <jao(at)geophile(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Static memory, shared memory |
Date: | 2021-01-09 17:17:59 |
Message-ID: | 400232.1610212679@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jack Orenstein <jao(at)geophile(dot)com> writes:
> I am writing a Postgres extension, and thought that I had memory
> corruption, (thanks for the --enable-cassert lead). I might, but It now
> looks like I need to understand the use of shared memory and locking in
> Postgres. So I have two questions.
> 1) I am now guessing that my original problem is caused by relying on
> static memory in my extension (i.e., in the source declaring
> PG_MODULE_MAGIC). This static memory is almost but not quite constant -- it
> is initialized from _PG_init, and then never modified. I suspect that this
> cannot work in general (since Postgres is multi-process), but I thought it
> would be adequate for early development. However, I am seeing this static
> memory get corrupted even when there is only a single process executing the
> extension code (verified by examining getpid()).
Define what you mean by "corrupted". It seems highly unlikely that any
code but your own is touching this memory.
Really the big-picture question here is what are you hoping to accomplish
and why do you think this memory might need to be shared?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jeremy Smith | 2021-01-09 19:20:50 | Re: How to keep format of views source code as entered? |
Previous Message | Alexander Farber | 2021-01-09 16:49:29 | Re: Select a column and then apply JSONB_ARRAY_ELEMENTS to it |