# std::allocator<T>::max_size

> C++ Atlas: `cppatlas.com/w/cpp/memory/allocator/max_size` | Source: https://en.cppreference.com/w/cpp/memory/allocator/max_size | Domain: Memory management | Standards: C++11, C++20

Returns the maximum theoretically possible value of n, for which the call allocate(n, 0) could succeed.

## Official Specification Summary (cppreference)

```cpp
size_type max_size() const throw(); // (until C++11)
size_type max_size() const noexcept; // (since C++11) (deprecated in C++17) (removed in C++20)
```

Returns the maximum theoretically possible value of `n`, for which the call `allocate(n, 0)` could succeed.

In most implementations, this returns `std::numeric_limits<size_type>::max() / sizeof(value_type)`.

### Parameters

(none)

### Return value

The maximum supported allocation size.

### See also

- [`max_size`](https://en.cppreference.com/w/cpp/memory/allocator_traits/max_size) [static]: returns the maximum object size supported by the allocator (public static member function of `std::allocator_traits<Alloc>`)

---
Attribution: content from https://en.cppreference.com/w/cpp/memory/allocator/max_size (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.