Do we want a xmalloc or similar function in the Backend?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Do we want a xmalloc or similar function in the Backend?
Date: 2012-06-19 14:17:29
Message-ID: 201206191617.29711.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

There are 70+ calls of malloc in the backend in the form of

type* foo = malloc(sizeof(...));
if(!foo)
elog(ERROR, "could not allocate memory");

which is a bit annoying to write at times. Would somebody argue against
introducing a function that does the above named xmalloc() or malloc_or_die()?

Greetings,

Andres
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-06-19 14:27:02 Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node
Previous Message Tom Lane 2012-06-19 14:17:01 Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node