# \[BUG\]: std::bad\_alloc: out\_of\_memory: CUDA error

**URL:** <https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885>\
**Category:** cuOpt\
**Tags:** cuopt\
**Created:** [August 22, 2025, 4:26pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885 "2025-08-22T16:26:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alberto.manzini](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alberto.manzini](https://forums.developer.nvidia.com/u/alberto.manzini)\
**Post date:** [August 22, 2025, 4:26pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/1 "2025-08-22T16:26:55Z")

</div>

Running this example [LP and MILP Examples — NVIDIA cuOpt (25.08)](https://docs.nvidia.com/cuopt/user-guide/latest/cuopt-python/lp-milp/lp-milp-examples.html#mixed-integer-linear-programming-example)  
I get this error

Setting parameter time\_limit to 6.000000e+01  
Problem status: NoTermination  
Solving a problem with 2 constraints 2 variables (2 integers) and 4 nonzeros  
Objective offset -0.000000 scaling\_factor -1.000000  
After trivial presolve updated 2 constraints 2 variables. Objective offset 0.000000  
Error in solve\_mip: std::bad\_alloc: out\_of\_memory: CUDA error (failed to allocate 2400000000 bytes) at: /\_\_w/rmm/rmm/cpp/include/rmm/mr/device/cuda\_memory\_resource.hpp:62: cudaErrorMemoryAllocation out of memory

Running on WLS

Anyone can help me?

---

<div class="post-metadata">

**Author:** ![alberto.manzini](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alberto.manzini](https://forums.developer.nvidia.com/u/alberto.manzini)\
**Post date:** [August 22, 2025, 4:30pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/2 "2025-08-22T16:30:17Z")

</div>

![image](https://global.discourse-cdn.com/nvidia/original/4X/8/7/6/876c6320d30ff74412adcb8bffe5dcffef63ee74.png)

---

<div class="post-metadata">

**Author:** ![ramakrishnap](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ramakrishnap/32/231202_2.png) [@ramakrishnap](https://forums.developer.nvidia.com/u/ramakrishnap)\
**Post date:** [August 22, 2025, 5:47pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/3 "2025-08-22T17:47:38Z")

</div>

Seems like you are out of memory while allocating GPU resources while running. cuOpt tried to acquire 2.5 GB and there wasn’t enough space left.

Are you by any chance running any other programs which are consuming GPU. If not, then in that case the bottle neck is insufficient GPU memory.

---

<div class="post-metadata">

**Author:** ![alberto.manzini](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alberto.manzini](https://forums.developer.nvidia.com/u/alberto.manzini)\
**Post date:** [August 25, 2025, 7:40am UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/4 "2025-08-25T07:40:23Z")

</div>

This shouldn’t happen because I should have 16GB of memory end the error is telling that the code cannot allocate 2,4 GB

I see that the GPU dedicated memory dimension is 4GB and the shared memory dimension is 16GB. Could the error be related to the dedicated memory dimension?

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/c/5/3/c531f523419bfd3b43868a5bba3be541c7a33873.png)

---

<div class="post-metadata">

**Author:** ![alberto.manzini](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alberto.manzini](https://forums.developer.nvidia.com/u/alberto.manzini)\
**Post date:** [August 25, 2025, 1:06pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/5 "2025-08-25T13:06:20Z")

</div>

FYI, these lines solved my problem

import rmm  
pool = rmm.mr.PoolMemoryResource(  
rmm.mr.ManagedMemoryResource(),  
initial\_pool\_size=“1GiB”,  
maximum\_pool\_size=“16GiB”  
)  
rmm.mr.set\_current\_device\_resource(pool)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [September 8, 2025, 1:06pm UTC](https://forums.developer.nvidia.com/t/bug-std-out-of-memory-cuda-error/342885/6 "2025-09-08T13:06:55Z")

</div>

Closed on September 8, 2025, 1:06pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
