I see GPU memory usage decrease in Windows using renderdoc if I hide volume rendering while “Auto-release resources is enabled” (using Slicer 4.13.0-2021-01-16 (revision 29612 / d264109) win-amd64 - installed release).
Memory usage changes in Task Manager (Shared GPU memory), too, but those reports are less consistent. After a volume is hidden or removed not all memory is released, but when loading volume again, the memory is reused. So, it seems that the currently allocated memory is reported rather than the actually used amount. Maybe nvidia-smi reports something similar.
I would recommend to try volume rendering of very large volumes in multiple processes to confirm that memory is actually released when needed; or use a tool like renderdoc to get more reliable information about the actual state of the rendering pipeline.
If you want to try renderdoc:
- launch renderdoc using
Slicer --launch qrenderdoc
- launch Slicer from it using File / Launch Application → SlicerApp-real
- capture frames before/after rendering and show/hide, etc.
- load each capture and check “Statistics” tab
For example:
After loading CTChest:
12 Textures - 27.05 MB (27.05 MB over 32x32), 6 RTs - 20.54 MB.
Avg. tex dimension: 963.333x758.333 (1155.6x909.6 over 32x32)
2 Buffers - 0.00 MB total 0.00 MB IBs 0.00 MB VBs.
47.59 MB - Grand total GPU buffer + texture load.
After showing volume rendering (140MB total GPU memory usage):
17 Textures - 166.07 MB (166.05 MB over 32x32), 7 RTs - 23.34 MB.
Avg. tex dimension: 936.4x506.5 (1048.33x843.333 over 32x32)
15 Buffers - 0.00 MB total 0.00 MB IBs 0.00 MB VBs.
189.41 MB - Grand total GPU buffer + texture load.
After hiding volume rendering (back to where it was before volume rendering):
12 Textures - 27.05 MB (27.05 MB over 32x32), 6 RTs - 20.54 MB.
Avg. tex dimension: 963.333x758.333 (1155.6x909.6 over 32x32)
9 Buffers - 0.00 MB total 0.00 MB IBs 0.00 MB VBs.
47.59 MB - Grand total GPU buffer + texture load.
After deleting the volume from the scene (no change in GPU memory usage):
12 Textures - 27.05 MB (27.05 MB over 32x32), 6 RTs - 20.54 MB.
Avg. tex dimension: 963.333x758.333 (1155.6x909.6 over 32x32)
15 Buffers - 0.00 MB total 0.00 MB IBs 0.00 MB VBs.
47.59 MB - Grand total GPU buffer + texture load.