ArtificialGuyBR

Home / Blog / Fixing things

Cut VRAM Use on Windows: HAGS, Page File, Overhead

What actually frees VRAM for AI workloads on Windows — measured settings, documented mechanisms, and community estimates without independent verification.

8 sources cited Fixing things

Cutting VRAM Use on Windows: Hardware-Accelerated GPU Scheduling, Page File Sizing, Browser and Desktop Overhead

TL;DR

If the real problem is that the card is too small for the model, our VRAM requirements by model covers what fits where.

What VRAM Actually Means on Windows

Windows reports two GPU memory categories in Task Manager: Dedicated GPU memory (the physical VRAM on your discrete GPU) and Shared GPU memory (a portion of system RAM that the OS can map into the GPU address space). AI frameworks (PyTorch, Stable Diffusion WebUI, ComfyUI) allocate from the dedicated pool through CUDA or DirectML. The desktop compositor, browsers, and Windows Terminal draw from the shared pool via DirectX/DirectWrite. The two pools are distinct on discrete GPUs — shrinking the shared pool does not grow the dedicated pool available to CUDA.

To see the split, open Task Manager → Details → right-click column headers → enable Dedicated GPU memory and Shared GPU memory. This shows per-process GPU memory broken down by pool. Microsoft Learn: Autoruns utility description (verifies the tool used to audit startup programs that may launch GPU-using apps).

Introduced with the Windows 10 May 2020 update, HAGS moves the GPU scheduler from a high-priority CPU thread onto a dedicated scheduling processor on the GPU itself. The DirectX Developer Blog states: "Windows can now offload most of GPU scheduling to a dedicated GPU-based scheduling processor" and "The settings page can be reached through Settings → System → Display → Graphics Settings." DirectX Developer Blog: Hardware Accelerated GPU Scheduling

What HAGS changes: frame pacing, multi-application GPU fairness, and submission latency. The old WDDM scheduler ran on the CPU; HAGS runs on a fixed-function block inside the GPU.

What HAGS does not change: VRAM allocation, CUDA context memory, or model weight footprint. The blog explicitly says "most applications have been designed to hide scheduling costs through buffering" and "We do not expect customers to experience performance regressions." It makes no claim about VRAM reduction. Enabling HAGS is recommended for smoother multi-app GPU sharing, not for freeing VRAM.

SettingLocationEffect on VRAMSource
Hardware-accelerated GPU schedulingSettings → System → Display → Graphics SettingsNone — scheduling onlyDirectX Dev Blog
Opt-in defaultOff by default (Windows 10 May 2020+)N/ADirectX Dev Blog

The Windows page file (pagefile.sys) backs committed system memory when physical RAM is exhausted. Neither Microsoft documentation nor NVIDIA driver documentation describes a mechanism where page file size influences dedicated GPU VRAM available to CUDA/DirectML workloads. The page file operates at the system RAM layer; VRAM is managed by the WDDM driver and the GPU scheduler independently.

If your system RAM is undersized relative to your workload, enlarging the page file prevents OOM kills but adds swap latency — it does not create additional VRAM. For AI workloads that fit in system RAM but exceed VRAM, the bottleneck is the PCIe transfer and the GPU's own memory controller, not the page file.

ClaimVerified?Notes
Larger page file = more VRAM for AINoNo primary source supports this
Page file affects shared GPU memoryIndirectlyShared GPU memory draws from system RAM commit; page file backs system RAM commit
Windows automatically manages shared GPU memoryYes — WDDM dynamically manages allocationNo primary source quantifies the shared pool capDirectX Dev Blog mentions WDDM but not pool caps

For the allocator side of the same problem, see PyTorch CUDA allocator tuning.

Desktop Overhead: What Actually Uses GPU Memory

Windows Compositor (dwm.exe)

The Desktop Window Manager composites the desktop, windows, and effects using DirectX. It allocates surfaces from the shared GPU memory pool, not the dedicated VRAM pool used by CUDA. The Civitai community article claims "An average windows (wdm.exe), browser and etc. use up to 2GB VRAM in background" — this figure is a community estimate with no measurement methodology published. Civitai article 8085

Visual Effects and Transparency

Windows Terminal

Windows Terminal uses GPU-accelerated text rendering via DirectWrite/DirectX. The Microsoft Learn overview states: "Windows Terminal uses the GPU to render its text, so it provides better performance than the default Windows command line experience." Microsoft Learn: Windows Terminal overview This rendering uses the graphics/composition VRAM context, not the CUDA compute context. Disabling Terminal GPU acceleration (via Terminal settings → Profile → Appearance → "Use hardware acceleration" = Off) reduces glyph atlas memory in the shared pool, but does not free dedicated VRAM for AI workloads.

ActionPool AffectedEstimated SavingsVerification
Disable transparency effectsShared GPU memoryUnquantifiedCommunity-reported only
"Adjust for best performance"Shared GPU memoryUnquantifiedNo Microsoft benchmark
Lower resolution (4K → 1080p)Shared GPU memoryReduces surface memory (exact MB unquantified)No primary measurement found
Disable Terminal hardware accelerationShared GPU memoryGlyph atlas memory (unquantified)Microsoft Terminal docs confirms GPU-accelerated rendering, not the savings from disabling it

On a 8GB card specifically, the FLUX on 8GB guide shows which quantisation makes the model load at all.

Browser Overhead

Hardware Acceleration

Browsers (Chrome, Edge, Firefox) enable GPU acceleration by default for compositing, video decode, and WebGL/WebGPU. This allocates textures and command buffers in the shared GPU memory pool. Disabling it (Settings → System → "Use graphics acceleration when available" → Off) forces software rendering, moving those allocations to system RAM.

Browser SettingPool AffectedMechanismVerified VRAM Impact
Disable hardware accelerationShared GPU memorySoftware rasterizationCommunity-reported only
chrome://gpucleanShared GPU memoryUndocumentedNo primary source
Memory Saver → MaximumShared GPU memoryTab discardNo published measurement
Close unused tabsShared GPU memoryProcess terminationDirect (process dies)

Startup Programs and Background Apps

Autoruns (Sysinternals) enumerates every auto-start location: Run/RunOnce keys, Explorer add-ons, Browser Helper Objects, AppInit DLLs, Winlogon notifications, services, and scheduled tasks. Microsoft Learn: Autoruns Disabling unnecessary startup entries reduces the number of processes that may initialize GPU contexts (e.g., game launchers, overlay tools, update checkers). The VRAM savings depend entirely on which programs you disable — no generic figure exists.

NVIDIA Driver Installation: NVCleanstall vs. Standard Installer

NVCleanstall strips components from the GeForce driver package: GeForce Experience, telemetry, HD Audio driver, NVENC encoder components, etc. TechPowerUp: NVCleanstall downloads The remaining driver still contains the full CUDA runtime, Vulkan ICD, and OpenGL ICD. Runtime VRAM usage for AI workloads is identical — NVCleanstall affects disk footprint, install time, and background services, not the CUDA memory allocator.

InstallerComponents RemovedRuntime VRAM Difference
Standard (GeForce Experience)NoneBaseline
NVCleanstallGFE, telemetry, audio, Ansel, etc.None (same CUDA runtime)

Windows Debloated Variants (AtlasOS, ReviOS, X-Lite, winutil)

These community projects remove Windows components, services, and scheduled tasks to reduce background resource usage. AtlasOS describes itself as "an optimized version of Windows, designed for enthusiasts and gamers." ReviOS claims to "reclaim the system you deserve — fast, private, stable." winutil is a PowerShell script collection for manual debloating.

VRAM impact: None of these projects publish GPU memory benchmarks. They reduce system RAM usage and CPU interrupts, which may indirectly reduce shared GPU memory pressure, but no dedicated VRAM savings are documented.

Dual-GPU Configuration (iGPU for Display, dGPU for AI)

Routing display output through the integrated GPU while reserving the discrete GPU for compute is a valid architecture. On Windows with WDDM, the compositor runs on the GPU driving the display. If the iGPU drives all monitors, dwm.exe allocates its surfaces from the iGPU's shared memory, leaving the dGPU's dedicated VRAM largely untouched by the desktop.

Caveat: The claim that this yields "0% VRAM usage of RTX 5090" is a community assertion Civitai article 8085. No NVIDIA or Microsoft documentation quantifies the residual dGPU VRAM consumption in this configuration. Some driver versions may still allocate minimal contexts on the dGPU for CUDA initialization or power management.

Common Errors and Fixes

SymptomCauseFixSource
HAGS enabled but VRAM unchangedHAGS optimizes scheduling, not memoryUse HAGS for multi-app fairness; do not expect VRAM reductionDirectX Dev Blog
chrome://gpuclean does not free VRAMURL undocumented; may only reset GPU processClose tabs instead; disable hardware acceleration if neededNo primary source
Page file increased, OOM persistsPage file backs system RAM, not VRAMReduce model batch size, enable CPU offload, or add physical RAMArchitecture fact
Transparency off but VRAM sameTransparency affects shared pool, not dedicated VRAMCheck Task Manager "Shared GPU memory" column for changeWindows memory architecture

FAQ

Does disabling Windows Transparency Effects reduce VRAM? It reduces shared GPU memory used by the compositor. Dedicated VRAM available to CUDA/DirectML is unaffected. Check Task Manager → Shared GPU memory column to observe the difference.

How much VRAM does dwm.exe use on Windows with a discrete GPU? No official Microsoft figure exists. Community estimates range from a few hundred MB to ~2 GB in the shared GPU memory pool, depending on resolution, refresh rate, and number of monitors. The dedicated VRAM pool is separate.

Does chrome://gpuclean actually free GPU memory or just reset the context? Unknown — no Chromium documentation describes this endpoint. Community reports suggest it restarts the GPU process, which would release its allocations, but this is unverified.

Why does HAGS not reduce VRAM, and what does it actually optimize? HAGS moves the GPU scheduler from a CPU thread to a dedicated GPU scheduling processor. It improves frame pacing and reduces submission latency between applications sharing the GPU. It does not manage VRAM allocation. DirectX Dev Blog

Does NVCleanstall change VRAM usage at inference time? No. NVCleanstall removes installer components (GeForce Experience, telemetry, audio driver). The installed CUDA runtime and driver memory manager are identical. TechPowerUp NVCleanstall

Does page file size affect VRAM available to Stable Diffusion / ComfyUI? No. The page file backs committed system memory. VRAM is managed by the WDDM driver and the GPU scheduler independently. If system RAM is exhausted, a larger page file prevents process kills but does not increase VRAM.

What is the fastest way to free shared GPU memory before an AI run? Close browser tabs and GPU-accelerated apps (Discord, Steam, game launchers). Disable transparency effects. Restart Windows Terminal if hardware acceleration is enabled. These shrink the shared pool; the dedicated VRAM pool for AI is unchanged.

Sources