Memory keeps growing during container scale tests

BlackJack 20 Reputation points
2026-07-14T14:37:06.92+00:00

Running thousands of Hyper-V isolated containers every day.

Everything finishes successfully, but memory usage on the host keeps increasing until we reboot it.

Looks like memory isn't being reclaimed after the containers are destroyed.

Any way to force Windows to clean this up?

Windows for business | Windows 365 Enterprise
0 comments No comments

1 answer

Sort by: Most helpful
  1. Tracy Le 10,325 Reputation points Independent Advisor
    2026-07-14T15:11:16.2033333+00:00

    Hello BlackJack,

    This memory leak happens because the Windows host aggressively caches the virtual disk operations of Hyper-V containers in the system file cache, and it does not release them even after the containers are destroyed. To force Windows to reclaim this memory during your automated runs, you can use the command-line version of RAMMap from Sysinternals with the argument rammap.exe -empty to flush the standby list.
    Alternatively, you can run a PowerShell script that calls the native Windows API SetSystemFileCacheSize to instantly trim the system working set and release the cached container files. This will safely free up the host memory without requiring a reboot or disrupting your scaling tests. Please try adding this cleanup step to your pipeline and let me know if it stabilizes the resource usage. If this solves the issue, please accept the answer so other community members can find it easily.

    Tracy Le.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.