How can I free my GPU memory in Ubuntu 14.04?

20,570

Solution 1

  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

Solution 2

nvidia-smi

NVIDIA System Management Interface program

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

Solution 3

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.

Share:
20,570

Related videos on Youtube

Hossein
Author by

Hossein

Updated on September 18, 2022

Comments

  • Hossein
    Hossein over 1 year

    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 |
    +-----------------------------------------------------------------------------+
    
    • Hossein
      Hossein about 8 years
      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?
    • Tooniis
      Tooniis over 4 years
      If you no longer want to use your desktop environment, then you may kill X and compiz.