valloc(3)

valloc3

Page-aligned memory allocation

Usage

#include <stdlib.h>

[[deprecated]] void *valloc(size_t size);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

valloc():

    Since glibc 2.12:
        (_XOPEN_SOURCE >= 500) && !(_POSIX_C_SOURCE >= 200112L)
            || /* glibc >= 2.19: */ _DEFAULT_SOURCE
            || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
    Before glibc 2.12:
        _BSD_SOURCE || _XOPEN_SOURCE >= 500

Library

Standard C library (libc, -lc)

Overview

valloc() allocates size bytes and returns a pointer to the allocated memory. The memory address will be a multiple of the page size.

It is equivalent to memalign(sysconf(_SC_PAGESIZE),size).

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
valloc()Thread safetyMT-Unsafe init

Versions

According to SUSv2, valloc() is declared in <stdlib.h>. glibc declares it in <malloc.h>, and also in <stdlib.h> if suitable feature test macros are defined (see above).

Caveats

See memalign(3).

Releases

12 releases since Debian 3.1 (Sarge); the text changed 11 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

Standards

BSD, GNU.

History

glibc 2.0. 3.0BSD. Documented as obsolete in 4.3BSD, and as legacy in SUSv2.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.