Re: palloc0

Lists: pgsql-hackers
From: mohsen soodkhah mohammadi <mohsensoodkhah(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: palloc0
Date: 2013-11-30 09:00:43
Message-ID: CAGT6x6ekrgf2vzDVxVrn=VQ3M03Xt4To2QLeodm0Wm=F2bgNpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

if I don't dalloc parameters that allocated with palloc0 then will free the
allocated memory at the end of transaction?


From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: mohsen soodkhah mohammadi <mohsensoodkhah(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: palloc0
Date: 2013-11-30 09:40:07
Message-ID: B63B2B31-38CC-4DC3-90E3-2689BA360A16@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sent from my iPad

> On 30-Nov-2013, at 14:30, mohsen soodkhah mohammadi <mohsensoodkhah(at)gmail(dot)com> wrote:
>
> if I don't dalloc parameters that allocated with palloc0 then will free the allocated memory at the end of transaction?

Yes, palloc allocates memory in contexts, and the memory allocated in these contexts by palloc are freed at the deletion of the context.

Regards,

Atri


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: mohsen soodkhah mohammadi <mohsensoodkhah(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: palloc0
Date: 2013-11-30 14:41:27
Message-ID: 5299F917.3000403@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 11/30/2013 04:00 AM, mohsen soodkhah mohammadi wrote:
> if I don't dalloc parameters that allocated with palloc0 then will
> free the allocated memory at the end of transaction?

Please read src/backend/utils/mmgr/README

cheers

andrew


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: mohsen soodkhah mohammadi <mohsensoodkhah(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: palloc0
Date: 2013-12-01 05:46:55
Message-ID: CAB7nPqSex6dNsM04DLUxjOvMW9tRNfmbarJ01VEP8it_BGRcCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Nov 30, 2013 at 11:41 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Please read src/backend/utils/mmgr/README
And that as well directly in the docs:
http://www.postgresql.org/docs/devel/static/xfunc-c.html#AEN53984
"The memory allocated by palloc will be freed automatically at the end
of each transaction, preventing memory leaks."
Regards,
--
Michael