---
name: "__gnu_cxx::malloc_allocator"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::malloc_allocator/3cxx"
---

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

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.
