# How can we release GPU memory cache?

**URL:** <https://discuss.pytorch.org/t/how-can-we-release-gpu-memory-cache/14530>\
**Category:** Uncategorized\
**Created:** [March 7, 2018, 10:10am UTC](https://discuss.pytorch.org/t/how-can-we-release-gpu-memory-cache/14530 "2018-03-07T10:10:36Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![debvrat](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/debvrat/32/23126_2.png) [@debvrat](https://discuss.pytorch.org/u/debvrat)\
**Post date:** [April 29, 2020, 3:24am UTC](https://discuss.pytorch.org/t/how-can-we-release-gpu-memory-cache/14530/18 "2020-04-29T03:24:52Z")

</div>

This works only some of the times.

Even when I clear out all the variables, restart the kernel, and execute `torch.cuda.empty_cache()` as the first line in my code, I still get a ‘CUDA out of memory’ error.

---

_[View the full topic](https://discuss.pytorch.org/t/how-can-we-release-gpu-memory-cache/14530)._
