# About cudaMallocManaged() granularity

**URL:** <https://forums.developer.nvidia.com/t/about-cudamallocmanaged-granularity/249900>\
**Category:** CUDA Programming and Performance\
**Created:** [April 14, 2023, 6:38am UTC](https://forums.developer.nvidia.com/t/about-cudamallocmanaged-granularity/249900 "2023-04-14T06:38:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeongjae](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jeongjae](https://forums.developer.nvidia.com/u/jeongjae)\
**Post date:** [April 14, 2023, 6:38am UTC](https://forums.developer.nvidia.com/t/about-cudamallocmanaged-granularity/249900/1 "2023-04-14T06:38:30Z")

</div>

Hello.

I have some questions about cudaMallocManaged() granularity. When I allocate unified memory by cudaMallocManaged() which size is under 128MiB, the free memory size is decreased 128MiB (ex. I allocated 16MiB Unified memory, but total global memory size is not 40GiB - 16Mib.) Why is this happening?

Below is my code flow.

GPU: NVIDIA A100 40GB  
CUDA driver version: 525.85.12  
CUDA version: 12.0

cudaMemgetinfo() // 1  
cudaMallocManaged(arr, 16MiB)  
init(arr)  
cudaMemprefetchAsync(arr, 16MiB)  
cudaMemgetinfo() // 2

2-1 is not 16MiB, it is 128MiB

---

<div class="post-metadata">

**Author:** ![cyunchae](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@cyunchae](https://forums.developer.nvidia.com/u/cyunchae)\
**Post date:** [April 14, 2023, 7:55am UTC](https://forums.developer.nvidia.com/t/about-cudamallocmanaged-granularity/249900/2 "2023-04-14T07:55:28Z")

</div>

I also have this problem with UVM. Waiting for an answer

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [April 14, 2023, 1:54pm UTC](https://forums.developer.nvidia.com/t/about-cudamallocmanaged-granularity/249900/3 "2023-04-14T13:54:16Z")

</div>

There is apparently some allocation granularity in CUDA. The details of it are not published. [Here](https://forums.developer.nvidia.com/t/cudamallocmanaged-malloc-memory-not-same-as-requested/73122/6) are some examples of related questions/discussion.
