---
name: "ldap_memory"
section: "3"
platform: "linux"
package: "libldap"
version: "2.7.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/ldap_memory"
---

# ldap\_memory(3)

LDAP memory allocation routines

## NAME

ldap\_memfree, ldap\_memvfree, ldap\_memalloc, ldap\_memcalloc, ldap\_memrealloc, ldap\_strdup - LDAP memory allocation routines

## LIBRARY

OpenLDAP LDAP (libldap, -lldap)

## SYNOPSIS

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

**void ldap\_memfree(void \****p***);**

**void ldap\_memvfree(void \*\****v***);**

**void \*ldap\_memalloc(ber\_len\_t** *s***);**

**void \*ldap\_memcalloc(ber\_len\_t** *n***, ber\_len\_t** *s***);**

**void \*ldap\_memrealloc(void \****p***, ber\_len\_t** *s***);**

**char \*ldap\_strdup(LDAP\_CONST char \****p***);**

## DESCRIPTION

These routines are used to allocate/deallocate memory used/returned by the LDAP library. **ldap\_memalloc**(), **ldap\_memcalloc**(), **ldap\_memrealloc**(), and **ldap\_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 **ldap\_memvfree**() routine is used to free a dynamically allocated array of pointers to arbitrary dynamically allocated objects. The **ldap\_strdup**() routine is used exactly like the standard [**strdup**(3)](/strdup/3.md) routine.

## SEE ALSO

[**ldap**(3)](/ldap/3.md)

## ACKNOWLEDGEMENTS

**OpenLDAP Software** is developed and maintained by The OpenLDAP Project \<http://www.openldap.org/\>. **OpenLDAP Software** is derived from the University of Michigan LDAP 3.3 Release.
