11

How can I free my gpu memory as much as possible?
Currently there seems 400+ MB of GPU ram to be always occupied!
How can I free these ?

Wed Feb 24 21:48:33 2016       
+------------------------------------------------------+                       
| NVIDIA-SMI 352.39     Driver Version: 352.39         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 750     Off  | 0000:01:00.0      On |                  N/A |
| 22%   31C    P8     0W /  38W |    438MiB /  2046MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0       731    C   /usr/bin/python                                 24MiB |
|    0      1121    G   /usr/bin/X                                     260MiB |
|    0      2058    G   compiz                                         140MiB |
|    0      8408    G   /proc/self/exe                                   3MiB |
+-----------------------------------------------------------------------------+
3
  • 2
    1. Ubuntu will do itself that when needed. 2. dumping it costs resources so will slow your system down 3. it will slow down even more since it will also reload it into memory.
    – Rinzwind
    Feb 24 '16 at 18:23
  • By freeing I meant removing or disabling any needed application as well. so basically that X, or compiz can be shut down right? they shouldnt be some system critical apps right?
    – Rika
    Feb 24 '16 at 19:29
  • 1
    If you no longer want to use your desktop environment, then you may kill X and compiz.
    – Tooniis
    Dec 9 '19 at 2:09
8
  1. Check what is using your GPU memory with sudo fuser -v /dev/nvidia*

The output will be as follows:

                     USER       PID   ACCESS  COMMAND
/dev/nvidia0:        root       10    F...m   Xorg
                     user       1025  F...m   compiz
                     user       1070  F...m   python
                     user       2001  F...m   python
  1. kill the PID that you no longer need with sudo kill -9 <PID>
    Example: sudo kill -9 2001
3

nvidia-smi

NVIDIA System Management Interface program

sudo nvidia-smi --gpu-reset -i 0
1

Go to NVDIA X server settings -> PRIME Profiled -> Turn on NVIDIA (On Demand). I had Performance mode enabled, which caused Xorg and gnome-shell to run on my dgpu and consume around 430mb memory. Be sure to reboot your PC once you set that option.

Although this question is 4yrs old, just leaving my answer here in case anyone finds it helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.