Fix game stutter on Win 10 1703-1809

Discussion in 'Videocards - NVIDIA GeForce Drivers Section' started by Mott, Apr 3, 2018.

  1. AveYo

    AveYo Member

    Messages:
    43
    Likes Received:
    48
    GPU:
    8800GS 384MB
    Hint: if using my v5+ FreeStandbyMemory.bat, can check if working by forcing a manual clear:
    - directly in PowerShell (Admin):
    iex (Get-ItemProperty Registry::HKLM\SOFTWARE\AveYo).FreeStandbyMemory
    - directly in Command Prompt (Admin):
    powershell -noprofile -c "& {iex (Get-ItemProperty Registry::HKLM\SOFTWARE\AveYo).FreeStandbyMemory}"
    - with self-elevating via any cmd / powershell / .bat / .lnk:
    Code:
    powershell -noprofile -c "start powershell -ArgumentList '-noprofile -c & {iex (Get-ItemProperty Registry::HKLM\SOFTWARE\AveYo).FreeStandbyMemory}'  -verb RunAs -WindowStyle Hidden"
    gist mirror: https://git.io/FreeStandbyMemory.bat
     
    Last edited: Oct 2, 2018
  2. Driller_au

    Driller_au Member Guru

    Messages:
    132
    Likes Received:
    20
    GPU:
    Asus 2080 Ti OC
    Personally I would prefer xxxxMB
     
  3. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    Do you mean you know how to purge each of standby list separately?
     
  4. AMD Ryzen R5

    AMD Ryzen R5 New Member

    Messages:
    1
    Likes Received:
    0
    GPU:
    GTX 1060 6GB
    [​IMG] Hello!
    This is my first posting.
    Since my english is not that good, I prefer to use the Google translator.
    Did the FreeStandbyMemory.bat run, but when I start Autoruns, it looks like this.
    looks like the program is not starting.
     

  5. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Possibly just the Priority 0. Must test / investigate first.
     
  6. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Also, I heard the issue was probably fixed with the latest cumulative update :
    6 septembre 2018 - KB4458469 (build 17134.320)

    Addresses an issue that ignores the MM_DONT_ZERO_ALLOCATION flag. This issue leads to degraded performance, and, occasionally, error 0x139 appears.

    Time to test.
     
  7. Mott

    Mott Master Guru

    Messages:
    911
    Likes Received:
    206
    GPU:
    MSI 6800XT GXT
    I've had fluid game play without any fix applied with that update. So far so good.
     
  8. Mott

    Mott Master Guru

    Messages:
    911
    Likes Received:
    206
    GPU:
    MSI 6800XT GXT
    Look like 1809 is officially out! I hope we get some new drivers for WDDM 2.5 that don't destroy everything like the last change over to 2.4 did. Anyone interested in the official ISO for Win 10 x64 1809 can download it here and let us know it is for gaming. I might upgrade today just for the WMR improvements but am a bit hesitant.
     
  9. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    @Wagnard I started to test CreateMemoryResourceNotification API, but I failed to stress global memory. Do you know ways to "eat" RAM?
     
  10. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    I will wait until NVIDIA releases next drivers (supposedly with support of 1809).
     

  11. Mott

    Mott Master Guru

    Messages:
    911
    Likes Received:
    206
    GPU:
    MSI 6800XT GXT
    Use a linlpack stress test or something like prime95. I know on the Intel burn test you can select maximum memory and it will fill it right up. Might not be what you're looking for but it is one way. Also, I guess you could just open a million Chrome tabs, lol.
     
  12. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    Will try this one - TestLimit64 from SysInternals suite
    https://blogs.msdn.microsoft.com/vijaysk/2012/10/26/tools-to-simulate-cpu-memory-disk-load/

    Update: This memory stress worked... Good.

    @Wagnard @AveYo You can use this tool to test the available memory treshold kick in:
    Testlimit64.exe -d -c NNNN
    where NNNN - megabytes to leak. You see in Resource monitor or any other app with memory info how many MB available and you execute this Testlimit64.exe to leak so that needed test value of available RAM remains. For example, you have 6000MB of available memory, so you execute "Testlimit64.exe -d -c 5600" to leak 5600MB so that only 400MB remains.
    After Testlimit64.exe does the leak it prints something (am on Russian locale so it was not readable) and waits. You can break its waiting with <Ctrl>+<C> and all leaked MBs return back to available.
     
    Last edited: Oct 2, 2018
  13. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    @Wagnard CreateMemoryResourceNotification API works, but I spent too much time at work doing actual work :(, so I will continue to test the treshold value tomorrow. Looks promising.
     
    Wagnard likes this.
  14. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Since 17134.320 (1803) fixed the issue, I will slow down develeopement of the app.
    1709 user are not fixed and may still need it.
    nice, keep us posted with your findings.

    Edit : 1 on my friend told me the stutter isn't fixed with 17134.320
    Look like the tools are still needed.
     
    Last edited: Oct 2, 2018
  15. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    According to RAMMap (tab "Priority Summary")
    when you call
    Code:
        int MemoryPurgeStandbyList = 4;
        NtSetSystemInformation(SystemMemoryListInformation, ref MemoryPurgeStandbyList, Marshal.SizeOf<int>());
    
    all standby lists are purged
    when you call
    Code:
        int MemoryPurgeLowPriorityStandbyList = 5;
        NtSetSystemInformation(SystemMemoryListInformation, ref MemoryPurgeLowPriorityStandbyList, Marshal.SizeOf<int>());
    
    only standby list of priority 0 is purged.

    Also note this "Marshal.SizeOf<int>()" - MS states that the form "Marshal.SizeOf(MemoryPurgeStandbyList)" is deprecated now and can go away any new release of .Net
     

  16. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    What would you use instead?
     
  17. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    In old code we used this "MarshalMarshal.SizeOf(MemoryPurgeStandbyList)" - with actual variable as parameter. In new code they tell to use "Marshal.SizeOf<int>()" instead - generic method with type of variable. Sorry my awkward English.


    I managed to retrieve SYSTEM_MEMORY_LIST_INFORMATION structure with NtQuerySystemInformation:
    Code:
            [DllImport("ntdll.dll", SetLastError = true)]
            static extern UInt32 NtQuerySystemInformation(int InfoClass, ref SYSTEM_MEMORY_LIST_INFORMATION Info, int Size, out uint Length);
    
            [StructLayout(LayoutKind.Sequential, Pack = 1)]
            public struct SYSTEM_MEMORY_LIST_INFORMATION
            {
                public UIntPtr ZeroPageCount;
                public UIntPtr FreePageCount;
                public UIntPtr ModifiedPageCount;
                public UIntPtr ModifiedNoWritePageCount;
                public UIntPtr BadPageCount;
                [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
                public UIntPtr[] PageCountByPriority;
                [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
                public UIntPtr[] RepurposedPagesByPriority;
                public UIntPtr ModifiedPageCountPageFile;
            }   
            ...
         
            int SystemMemoryListInformation = 0x0050;
            SYSTEM_MEMORY_LIST_INFORMATION MemoryList = new SYSTEM_MEMORY_LIST_INFORMATION ();
            uint resultSize;
            int res = (UInt32)NtQuerySystemInformation(SystemMemoryListInformation, ref MemoryList, Marshal.SizeOf<SYSTEM_MEMORY_LIST_INFORMATION>(), out resultSize);
            if (res != 0)
            {
                Console.Error.Write("Error in NtQuerySystemInformation: {0}", Marshal.GetLastWin32Error());
                return 3;
            }
            Console.WriteLine("List information:\nZeroPageCount={0,12}\nFreePageCount={1,12}\nModifiedPageCount={2,12}\nPageCountByPriority[0..7]={3}\n",
                    MemoryList.ZeroPageCount, MemoryList.FreePageCount, MemoryList.ModifiedPageCount, string.Join(",", MemoryList.PageCountByPriority));
    
    Fields are in pages. Information is confirmed by RAMMap.
    Field PageCountByPriority - is array of standby lists.
    Field RepurposedPagesByPriority - is array of repurposed lists (but I don`t remember what are they).
     
    Last edited: Oct 3, 2018
  18. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,911
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    Now I can state the correlation between "Memory" performance counters and stanby lists in RAMMap:

    Standby Cache Core Bytes = standby list priority 7
    Standby Cache Normal Priority Bytes = standby list priority 5
    Standby Cache Reserve Bytes = summary of standby lists priorities 0-4

    PS And standby list priority 6 is always 0...
     
    Wagnard likes this.
  19. Astyanax

    Astyanax Ancient Guru

    Messages:
    10,944
    Likes Received:
    4,033
    GPU:
    GTX 1080ti
    Aida64 stability test
     
  20. BuildeR2

    BuildeR2 Ancient Guru

    Messages:
    2,906
    Likes Received:
    151
    GPU:
    MSI 2080 Ti GX Trio
    Very interesting to follow, since I'm still on 1709 for now. Keep up the awesome work, guys. :)
     

Share This Page