Do we want a xmalloc or similar function in the Backend? - Mailing list pgsql-hackers

From Andres Freund
Subject Do we want a xmalloc or similar function in the Backend?
Date
Msg-id 201206191617.29711.andres@2ndquadrant.com
Whole thread Raw
Responses Re: Do we want a xmalloc or similar function in the Backend?
Re: Do we want a xmalloc or similar function in the Backend?
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node
Next
From: Andres Freund
Date:
Subject: Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node