﻿# HIP memory pools: reserved bytes and live allocation bytes explain different states

Interpret HIP pool accounting, release thresholds and trim operations without mistaking cached device memory for an active allocation or a guaranteed reclaimable total.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-hip-memory-pool-reserved-used-trim/
Language: en

## Start with the pool's identity

An inference extension frees a temporary allocation while a device monitor still shows substantial memory use. First identify the HIP memory pool that served the request. A device's default pool, a configured current pool and a separately created pool should not be treated as one anonymous cache. Record which allocation path was used. Measurements of an unrelated pool cannot explain the memory retained by the allocator actually supplying the application.

## Read reservation and use separately

The [SOMA guide](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_runtime_api/memory_management/stream_ordered_allocator.html) distinguishes reserved and used memory attributes, including current and high-water values. A reservation can remain after allocations finish because the pool retains backing memory for reuse. A high-water statistic describes history rather than a current leak. For diagnosis, capture attribute values at named completion boundaries and keep those readings separate from application tensor sizes and whole-device monitoring.

## Treat the threshold as a release policy

The [allocator API reference](https://rocm.docs.amd.com/projects/HIP/en/latest/reference/hip_runtime_api/modules/memory_management/stream_ordered_memory_allocator.html) documents pool attributes and hipMemPoolTrimTo. The release threshold controls retention behavior; it is not a cap guaranteeing that allocation fails at that number. An explicit trim concerns eligible freed memory, not memory still needed by outstanding work. Do not respond to a large reservation by assuming that every retained byte can immediately be reclaimed while kernels continue using allocations.

## Preserve types and completion in the experiment

The [HIP runtime declarations](https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/hip__runtime__api_8h.html) help verify argument and attribute interfaces against the installed headers. Match attribute value types and check call results. Compare readings before allocation, after completed use and free, and after the chosen trim. The order matters because an enqueued free is not equivalent to completed release. A measurement taken too early can describe an allocation still in use rather than the retention policy under investigation.

## Explain the tradeoff without inventing savings

Retaining memory may avoid repeated allocation work, while aggressive release can reduce idle reservation and increase later setup. Measure the workload that actually matters rather than promising universal latency or capacity gains. Related guides cover [reproducible stacks](/journal/software-stack-reproducibility/) and [stream dependencies](/journal/learn-stream-ordering-dependencies/). Report the pool, observed states and tested policy. This establishes what retained memory means; it does not equate pool statistics with all GPU memory consumed by the process.
