Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions 04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ if [ ! -f "$SD04_DIR/parameters.txt" ]; then
fi
# Load updated malloc to fix memory leak
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/6850#issuecomment-1432435503
if [ ! -f "$SD04_DIR/webui/webui-user.sh" ]; then
cat >"$SD04_DIR/webui/webui-user.sh" <<EOL
export LD_PRELOAD=libtcmalloc.so
echo "libtcmalloc loaded"
EOL
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6722
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6722#discussioncomment-6161333
if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then
TCMALLOC="$(ldconfig -p | grep -Po "libtcmalloc_minimal.so.\d" | head -n 1)"
if [[ ! -z "${TCMALLOC}" ]]; then
echo "Using TCMalloc: ${TCMALLOC}"
export LD_PRELOAD="${TCMALLOC}"
fi
fi

# Create venv
Expand Down