---
name: "lber-memory"
section: "3"
platform: "macos"
package: "OpenLDAP"
version: "561"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/lber-memory"
---

# lber-memory(3)

OpenLDAP LBER memory allocators

## NAME

ber\_memalloc, ber\_memcalloc, ber\_memrealloc, ber\_memfree, ber\_memvfree - OpenLDAP LBER memory allocators

## LIBRARY

OpenLDAP LBER (liblber, -llber)

## SYNOPSIS

**#include \<lber.h\>**

**void \*ber\_memalloc(ber\_len\_t** *bytes***);**

**void \*ber\_memcalloc(ber\_len\_t** *nelems***, ber\_len\_t** *bytes***);**

**void \*ber\_memrealloc(void \****ptr***, ber\_len\_t** *bytes***);**

**void ber\_memfree(void \****ptr***);**

**void ber\_memvfree(void \*\****vec***);**

## DESCRIPTION

These routines are used to allocate/deallocate memory used/returned by the Lightweight BER library as required by [**lber-encode**(3)](/lber-encode/3.md) and [**lber-decode**(3)](/lber-decode/3.md). **ber\_memalloc**(), **ber\_memcalloc**(), **ber\_memrealloc**(), and **ber\_memfree**() are used exactly like the standard [**malloc**(3)](/malloc/3.md), [**calloc**(3)](/calloc/3.md), [**realloc**(3)](/realloc/3.md), and [**free**(3)](/free/3.md) routines, respectively.  The **ber\_memvfree**() routine is used to free a dynamically allocated array of pointers to arbitrary dynamically allocated objects.

## SEE ALSO

[**lber-decode**(3)](/lber-decode/3.md), [**lber-encode**(3)](/lber-encode/3.md), [**lber-types**(3)](/lber-types/3.md)

## ACKNOWLEDGEMENTS
