stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

support loading libtcmalloc_minimal.dll for windows

Open wkpark opened this issue 1 year ago • 1 comments

Description

The effectiveness of tcmalloc has been discussed in several other threads. For Windows, LD_PRELOAD is not available, but the tcmalloc_minimal module supported by gperftool can be compiled with patch type to use with Windows and perform hot patching already loaded modules.

How to compile/install tcmalloc_minimal

  • git checkout https://github.com/gperftools/gperftools/
  • install visual c++ 2022 + open cmd.exe and cd go_to_gperfoools
  • cd gperftools\vsprojects\libtcmalloc_minimal
  • msbuild /property:Configuration=Release-Patch
  • copy x64\Release-Patch\libtcmalloc_minimal.dll to the top dir of webui

Notes

  • some extensions will not work as expected with strange error msg. (e.g. Adetailer)

Checklist:

wkpark avatar Oct 26 '24 15:10 wkpark

It’s working like a charm, thanks! I didn’t benchmark it computationally, but the workflow feels more lightweight. On my machine all extensions work as expected with no strange error msg.

Sidenote: The Visual Studio .sln project provided in the original repository of gperftools-2.16 was created with Visual Studio 2019 build tools v142. For a build with MSBuild version 17.13.19 (VS 2022) I edited the libtcmalloc_minimal.vcxproj file. In the PropertyGroup element: < PropertyGroup … 'Release-Patch|x64'> from v142 to < PlatformToolset >v143</ PlatformToolset>

built from the command line: msbuild vsprojects\libtcmalloc_minimal\libtcmalloc_minimal.vcxproj /property:Configuration=Release-Patch /p:platform=x64

OS: Windows11 Web Ui Version: v1.10.1

bmFicg avatar Mar 18 '25 09:03 bmFicg