# litert::Mallocator


`#include <litert_buffer_ref.h>`

Defines allocation and deallocation behavior for owning buffer refs.

## Summary

An allocator is a trivially constructible/destructible object that overrides `operator()` for allocating and freeing memory. A memory allocator based on `malloc` and `free`.
Details Template Parameters `ByteT` The byte type of the buffer.

| ### Public functions ||
|---|---|
| `https://developers.google.com/edge/api/litert/c/structlitert/1-1-mallocator#structlitert_1_1_mallocator_1ab08801fb9bfe9e67f66f24a340cb9721(ByteT *d)` | `void` Frees the given memory block. |
| `https://developers.google.com/edge/api/litert/c/structlitert/1-1-mallocator#structlitert_1_1_mallocator_1a0c5f58ce6bcb8ef7a03b17e1b05fd45b(size_t bytes)` | `ByteT *` Allocates a memory block of the specified size. |

## Public functions

### operator()

```
void litert::Mallocator::operator()(
  ByteT *d
)
```
Frees the given memory block.

### operator()

```
ByteT * litert::Mallocator::operator()(
  size_t bytes
)
```
Allocates a memory block of the specified size.

<br />

Details Parameters `bytes` The size of the memory block in bytes. **Returns** A pointer to the allocated memory.