---
name: "ne_malloc"
section: "3"
platform: "linux"
package: "neon"
version: "0.37.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ne_malloc"
---

# ne\_malloc(3)

memory allocation wrappers

## NAME

ne\_malloc, ne\_calloc, ne\_realloc, ne\_strdup, ne\_strndup, ne\_oom\_callback - memory allocation wrappers

## SYNOPSIS

```
#include <ne_alloc.h>
```

**void \*ne\_malloc(size\_t** *size***);**

**void \*ne\_calloc(size\_t** *size***);**

**void \*ne\_realloc(void \****size***, size\_t** *len***);**

**char \*ne\_strdup(const char \****s***);**

**char \*ne\_strndup(const char \****s***, size\_t** *size***);**

**void ne\_oom\_callback(void (\****callback***)(void));**

## DESCRIPTION

The functions **ne\_malloc**, **ne\_calloc**, **ne\_realloc**, **ne\_strdup** and **ne\_strdnup** provide wrappers for the equivalent functions in the standard C library. The wrappers provide the extra guarantee that if the C library equivalent returns NULL when no memory is available, an optional callback will be called, and the library will then call **abort**().

**ne\_oom\_callback** registers a callback which will be invoked if an out of memory error is detected.

## NOTES

If the operating system uses optimistic memory allocation, the C library memory allocation routines will not return NULL, so it is not possible to gracefully handle memory allocation failures.

## COPYRIGHT

Copyright © 2001-2026 Joe Orton\
