• Bruce Dawson's avatar
    Add Windows heap trimming tool · a6153cfe
    Bruce Dawson authored
    This is an experimental tool which will inject a thread into a Chrome
    process (tested on the browser and GPU process) and run code to call
    HeapSetInformation with HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION. This
    tells Windows to trim unnecessary memory from the heaps in that process.
    
    This tool uses sketchy techniques such as copying memory from one
    executable to another (only works if the code is relocatable and has no
    external references), VirtualAllocEx, and CreateRemoteThread. This is
    not for production use.
    
    To build run build.bat
    To run either run it manually (passing the PIDs of the processes of
    interest) or run trim_loop.bat (passing the PIDs of the processes of
    interest) to run it every five minutes in a loop.
    
    While it sometimes frees non-trivial amounts of memory the savings are
    not persistent.
    
    Bug: 1050059, 982452
    Change-Id: I646c515e59598c2c3003500419c154bacd34aeda
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2139127
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: default avatarDavid Bienvenu <davidbienvenu@google.com>
    Reviewed-by: default avatarJesse McKenna <jessemckenna@google.com>
    Reviewed-by: default avatarJames Forshaw <forshaw@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#757644}
    a6153cfe
OWNERS 78 Bytes