惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
J
Java Code Geeks
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
U
Unit 42
B
Blog
宝玉的分享
宝玉的分享
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - Franky
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
博客园 - 叶小钗

kkocdko's blog

Tasker 永久试用修改思路 - kkocdko's blog 极限压缩文档扫描件 - kkocdko's blog Bypass the Blank Chars Detection crknob - Chrome portable patch 我如何将博客首页体积降至 3 KB - kkocdko's blog 如何极限优化压缩文件体积 - kkocdko's blog EmEditor 精简版 - kkocdko's blog Backup Data from VSCode Web 优雅地游玩 Minecraft - kkocdko's blog 让程序以管理员权限运行的 PE 清单 - kkocdko's blog 注销 ZEIT 账号之后遇到的坑 - kkocdko's blog 本博客的协议已更改为 CC0 - kkocdko's blog mobp - 使 MSOffice 后台常驻 在安装 VS 生成工具时规避 .NET 安装错误 各种格式的占位空文件 - kkocdko's blog 优雅地游玩 Flash 游戏 - kkocdko's blog WPS 2016 极限精简版 - kkocdko's blog Convert Const to Let by Terser 规避 Visual Studio 许可证过期的 Bug 方便地使用 iPod - kkocdko's blog 用 UserJS 注入 UserCSS - kkocdko's blog 注册表修改文件关联(默认程序) - kkocdko's blog 周期精准的太阳系模型 - kkocdko's blog 关闭屏幕的 WinAPI - kkocdko's blog 重置 Windows 图标缓存 - kkocdko's blog AIDA64 极限精简单文件版 - kkocdko's blog 几何画板单文件精简版 - kkocdko's blog 世界之窗浏览器单文件版 - kkocdko's blog 在 MBR + Legacy 下用 Bootmgr 引导 Ubuntu 简洁的 Markdown 预览工具 - kkocdko's blog
Reduce memory usage of FreeCAD and OrcaSlicer
2026-04-11 · via kkocdko's blog

FreeCAD

Main idea: Qt PySide compiles and embed QRC into huge xxx_rc.py, I dump data as bin file and use open().

And there's more you can strip, on my debian 13 these runs well.

curl -o FreeCAD.AppImage -L https://github.com/FreeCAD/FreeCAD/releases/download/1.1.0/FreeCAD_1.1.0-Linux-x86_64-py311.AppImage
chmod +x FreeCAD.AppImage
./FreeCAD.AppImage --appimage-extract
mv squashfs-root FreeCAD
cd FreeCAD
pushd usr ; rm -rf man fonts ssl ; popd
pushd usr/share ; rm -rf doc icons man mysql opencv4 wayland wayland-protocols ; popd
pushd usr/lib ; rm -rf cmake pkgconfig qt6/bin qt6/plugins/qmlls qt6/qml/QtQuick libQt6Quick* $(ls | grep -E "^(lib)?(LLVM|clang|openvino|avcodec|rav1e|dav1d|avif|x265|x264|aom|SvtAv1Enc|opencv|mysqlclient|pcl|proto(buf|c)|gtk|wayland)[\._-]") ; popd # vtk is used by mesh
pushd usr/lib/python3.11 ; rm -rf ensurepip ; popd
pushd usr/lib/python3.11/site-packages ; rm -rf OCC pandas scipy debugpy ifcopenshell pip ; popd
for entry in $(find -name "*_rc.py"); do
  suffix="$(tail -n 8 $entry | tr "\n" "|")"
  (tail -n +8 $entry | head -n -8 ; printf "with open(__file__+'.qrc_name.bin','wb')as f:\n    f.write(qt_resource_name)\nwith open(__file__+'.qrc_struct.bin','wb')as f:\n    f.write(qt_resource_struct)\nwith open(__file__+'.qrc_data.bin','wb')as f:\n    f.write(qt_resource_data)\nexit()") > $entry.tmp
  mv $entry.tmp $entry
  usr/bin/python $entry
  (printf "from PySide6 import QtCore\nwith open(__file__+'.qrc_name.bin','rb')as f:\n    qt_resource_name=f.read()\nwith open(__file__+'.qrc_struct.bin','rb')as f:\n    qt_resource_struct=f.read()\nwith open(__file__+'.qrc_data.bin','rb')as f:\n    qt_resource_data=f.read()\n" ; echo "$suffix" | tr "|" "\n") > $entry
done
sed -i -e 's/export QT_QPA_PLATFORM=/# &/' -e 's/"${MAIN}"/exec &/' AppRun
QT_SCALE_FACTOR=1 QT_SCREEN_SCALE_FACTORS=1 QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_ENABLE_HIGHDPI_SCALING=0 QT_FONT_DPI=120 XKB_CONFIG_ROOT=/usr/share/X11/xkb ./AppRun
# Menu > Edit > Preferences > Display > Use OpenGL VBO
# Wayland: https://github.com/FreeCAD/FreeCAD/issues/6068
# tar -c FreeCAD | xz -T2 -9e --block-size $(( $(tar -c FreeCAD | wc -c) / 2 + 64 )) > FreeCAD.tar.xz # see mkdebian, todo: a new post for 2 block xz

Before (left) and after (right):

Screenshot to compare memory usage

OrcaSlicer

The custom font and homepage webview use lots of memory.

curl -o OrcaSlicer.AppImage -L https://github.com/OrcaSlicer/OrcaSlicer/releases/download/v2.3.2/OrcaSlicer_Linux_AppImage_Ubuntu2404_V2.3.2.AppImage
chmod +x OrcaSlicer.AppImage
./OrcaSlicer.AppImage --appimage-extract
apt install --no-install-recommends libwebkit2gtk-4.1-0 libglu1-mesa libmspack0t64 # for debian 13
# reduce memory usage a lot
mv resources/hms resources/hms.bak
mv resources/fonts resources/fonts.bak
mv resources/web/homepage/index.html resources/web/homepage/index.html.bak
echo '<!doctype html><html style="background:#000"><script>window.close()</script>' > resources/web/homepage/index.html
# force enable dark mode
export GTK_THEME=adw-gtk3-dark
export ORCA_SLICER_DARK_THEME=true
# kill webkit processes
(nohup sh -c 'sleep 3 ; kill $(pgrep -P $(pgrep orcaslicer_main))' > /dev/null 2>&1 &)