# Memory

Tracked allocation, raw storage copies, borrowed array views and size
inquiries. All routines are available through `use futile`.

### Borrowed views and raw copies

| Routine                                                       | Description                                                                         |
|---------------------------------------------------------------|-------------------------------------------------------------------------------------|
| [f_subptr](f_subptr.md)       | Borrowed rank-one pointer view into existing contiguous storage, without copying.   |
| [f_subptr_str](f_subptr_str.md)   | Borrowed rank-one `character(len=1)` view counting characters, not string elements. |
| [f_memcpy](f_memcpy.md)       | Raw storage copy, with `n` counting source elements; overlap-safe.                  |
| [f_memcpy_bytes](f_memcpy_bytes.md) | Raw storage copy between scalar buffer starts with an explicit byte count.          |

### Size inquiries and binding buffers

| Routine                                                      | Description                                                                       |
|--------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [f_size](f_size.md)        | Number of elements, as `integer(f_size_t)`, without element access.               |
| [f_sizeof](f_sizeof.md)      | Payload storage in C bytes, as `integer(f_size_t)`, without element access.       |
| [f_dump_buffer](f_dump_buffer.md) | Binding-owned character dump buffer (C `f90_f_dump_buffer_*`, C++ `FDumpBuffer`). |

### Allocation and comparison

These interfaces are described on the [Memory handling](../../memory.md) page.

| Routine                       | Description                                                                        |
|-------------------------------|------------------------------------------------------------------------------------|
| `f_malloc` / `f_free`         | Tracked allocation and deallocation of allocatable arrays.                         |
| `f_malloc_ptr` / `f_free_ptr` | Tracked allocation and deallocation of pointer arrays, including aligned pointers. |
| `f_maxdiff`                   | Maximum absolute difference between two buffers.                                   |
