---
name: "__gnu_cxx::malloc_allocator"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::malloc_allocator"
---

# \_\_gnu\_cxx::malloc\_allocator(3)

An allocator that uses malloc.

## NAME

\_\_gnu\_cxx::malloc\_allocator\< \_Tp \> - An allocator that uses malloc.

## SYNOPSIS

\#include \<malloc\_allocator.h\>

### Public Types

typedef std::ptrdiff\_t **difference\_type**\
 typedef **std::true\_type** **propagate\_on\_container\_move\_assignment**\
 typedef std::size\_t **size\_type**\
 typedef \_Tp **value\_type**\

### Public Member Functions

constexpr **malloc\_allocator** (const malloc\_allocator &) noexcept\
 template\<typename \_Tp1\> constexpr **malloc\_allocator** (const malloc\_allocator\< \_Tp1 \> &) noexcept\
 \_Tp \* **allocate** (size\_type \_\_n, const void \*=0)\
 void **deallocate** (\_Tp \*\_\_p, size\_type)\

### Friends

template\<typename \_Up\> constexpr bool **operator==** (const malloc\_allocator &, const malloc\_allocator\< \_Up \> &) noexcept\

## Detailed Description

### template\<typename \_Tp\>

class \_\_gnu\_cxx::malloc\_allocator\< \_Tp \>"An allocator that uses malloc.

This is precisely the allocator defined in the C++ Standard.

- •

  all allocation calls malloc

- •

  all deallocation calls free

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
