palloc0

Started by mohsen soodkhah mohammadiabout 12 years ago4 messages
#1mohsen soodkhah mohammadi
mohsensoodkhah@gmail.com

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

#2Atri Sharma
atri.jiit@gmail.com
In reply to: mohsen soodkhah mohammadi (#1)
Re: palloc0

Sent from my iPad

On 30-Nov-2013, at 14:30, mohsen soodkhah mohammadi <mohsensoodkhah@gmail.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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Andrew Dunstan
andrew@dunslane.net
In reply to: mohsen soodkhah mohammadi (#1)
Re: palloc0

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Michael Paquier
michael.paquier@gmail.com
In reply to: Andrew Dunstan (#3)
Re: palloc0

On Sat, Nov 30, 2013 at 11:41 PM, Andrew Dunstan <andrew@dunslane.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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers