# Freeing up memory on the device

**URL:** <https://forums.developer.nvidia.com/t/freeing-up-memory-on-the-device/9010>\
**Category:** CUDA Programming and Performance\
**Created:** [April 20, 2009, 11:32pm UTC](https://forums.developer.nvidia.com/t/freeing-up-memory-on-the-device/9010 "2009-04-20T23:32:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mischan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mischan](https://forums.developer.nvidia.com/u/mischan)\
**Post date:** [April 20, 2009, 11:32pm UTC](https://forums.developer.nvidia.com/t/freeing-up-memory-on-the-device/9010/1 "2009-04-20T23:32:58Z")

</div>

Hello all,

If I am in a kernel and wish to free up some memory on the device pointed to be \*myDevicePtr, how do I do that from inside a kernel function?

I couldn’t find anything on the cuda api for doing that, and using free() results in an error that I can use a host function only in emulation mode.

Thanks for your input!

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [April 21, 2009, 12:46am UTC](https://forums.developer.nvidia.com/t/freeing-up-memory-on-the-device/9010/2 "2009-04-21T00:46:27Z")

</div>

You can’t do memory management directly from the device. Read the manual again because if you’re asking the question you don’t understand how the architecture is set up and the difference between the device’s execution model and the CPU.
