Skip site navigation (1) Skip section navigation (2)

Re: xmalloc => pg_malloc

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: xmalloc => pg_malloc
Date: 2012-10-02 16:19:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tuesday, October 02, 2012 06:02:13 PM Tom Lane wrote:
> While looking around to fix the pg_malloc(0) issue, I noticed that
> various other pieces of code such as pg_basebackup have essentially
> identical functions, except they're called xmalloc().  I propose to
> standardize all these things on this set of names:
> 	pg_malloc
> 	pg_malloc0	(for malloc-and-zero behavior)
> 	pg_calloc	(randomly different API for pg_malloc0)
Do we need this?

> 	pg_realloc
> 	pg_free
> 	pg_strdup
I wonder whether the same set of functions should also be available in the 
backend with ereport(EC_OUT_OF_MEMORY, ...) behaviour as well. As noted before 
the are quite some malloc() calls around. Not all of them should be replaced, 
but I think quite some could.

Andres Freund
PostgreSQL Development, 24x7 Support, Training & Services

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2012-10-02 16:21:34
Subject: Re: xmalloc => pg_malloc
Previous:From: Peter GeogheganDate: 2012-10-02 16:05:49
Subject: Re: pgsql: Disable _FORTIFY_SOURCE with ICC

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group