Re: Replace use malloc() & friend by memory contexts for plperl and pltcl

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replace use malloc() & friend by memory contexts for plperl and pltcl
Date: 2016-11-07 22:39:12
Message-ID: bcf1bfcf-d150-24cf-79a3-39a3d2b07b3e@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/31/16 2:57 AM, Michael Paquier wrote:
> Hi all,
>
> Cleanup $subject has been raised a couple of times, like one year ago here:
> https://www.postgresql.org/message-id/CAB7nPqRxvq+Q66UFzD9wa5UAftYN4WAUADbjXKFrync96kf-VQ@mail.gmail.com
> And more recently here while working on the NULL checks for malloc():
> https://www.postgresql.org/message-id/CAB7nPqR7ozfCqc6C=2+ctCcnuehTZ-vTDQ8MMhY=BQyET0Honw@mail.gmail.com
>
> Attached are a set of patches to replace those memory system calls by
> proper memory contexts:
> - 0001 does the cleanup work for pltcl
> - 0002 does this cleanup for plperl
>
> Thoughts?

Seems like a good idea, I'm guessing it slipped through the cracks. Do
you want to add it to the next CF?

I've looked at the pltcl patch, and it looks sane. I did have one
question though...

+ volatile MemoryContext plan_cxt = NULL;
...
+ MemoryContext oldcontext = CurrentMemoryContext;

Why mark one as volatile but not the other? Based on [1] ISTM there's no
need to mark either as volatile?

1: http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2016-11-07 23:42:52 Re: Remove the comment on the countereffectiveness of large shared_buffers on Windows
Previous Message Merlin Moncure 2016-11-07 22:31:18 Re: emergency outage requiring database restart