MCPcopy Create free account
hub / github.com/apache/cloudberry / pg_malloc_internal

Function pg_malloc_internal

src/common/fe_memutils.c:22–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "postgres_fe.h"
21
22static inline void *
23pg_malloc_internal(size_t size, int flags)
24{
25 void *tmp;
26
27 /* Avoid unportable behavior of malloc(0) */
28 if (size == 0)
29 size = 1;
30 tmp = malloc(size);
31 if (tmp == NULL)
32 {
33 if ((flags & MCXT_ALLOC_NO_OOM) == 0)
34 {
35 fprintf(stderr, _("out of memory\n"));
36 exit(EXIT_FAILURE);
37 }
38 return NULL;
39 }
40
41 if ((flags & MCXT_ALLOC_ZERO) != 0)
42 MemSet(tmp, 0, size);
43 return tmp;
44}
45
46void *
47pg_malloc(size_t size)

Callers 6

pg_mallocFunction · 0.85
pg_malloc0Function · 0.85
pg_malloc_extendedFunction · 0.85
pallocFunction · 0.85
palloc0Function · 0.85
palloc_extendedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected