# Model.to("cpu") does not release GPU memory allocated by registered buffer

**URL:** <https://discuss.pytorch.org/t/model-to-cpu-does-not-release-gpu-memory-allocated-by-registered-buffer/126102>\
**Category:** Uncategorized\
**Created:** [July 7, 2021, 4:22pm UTC](https://discuss.pytorch.org/t/model-to-cpu-does-not-release-gpu-memory-allocated-by-registered-buffer/126102 "2021-07-07T16:22:24Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![ljj7975](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ljj7975/32/12561_2.png) [@ljj7975](https://discuss.pytorch.org/u/ljj7975)\
**Post date:** [July 8, 2021, 6:53pm UTC](https://discuss.pytorch.org/t/model-to-cpu-does-not-release-gpu-memory-allocated-by-registered-buffer/126102/6 "2021-07-08T18:53:29Z")

</div>

“you cannot delete the CUDA context while the PyTorch process is still running”

> [@Clearing the GPU is a headache](https://discuss.pytorch.org/t/clearing-the-gpu-is-a-headache/84762/10):
>
> No, you cannot delete the CUDA context while the PyTorch process is still running and would have to shutdown the current process and use a new one for the downstream application.

---

_[View the full topic](https://discuss.pytorch.org/t/model-to-cpu-does-not-release-gpu-memory-allocated-by-registered-buffer/126102)._
