Commit 6340591
perf(linux): trim glibc malloc arena after module loading
On Linux, glibc's malloc doesn't release freed memory back to the OS,
causing RSS to be 3-5x higher than on Windows for the same workload.
This is especially noticeable when loading large TypeScript codebases
(e.g. generated OpenAPI clients) where module compilation creates heavy
allocation churn.
Call `malloc_trim(0)` after the main/side module loading phase completes
to force glibc to release unused heap pages back to the OS.
Closes #25722
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 40b56f7 commit 6340591
1 file changed
+26
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
858 | | - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
859 | 873 | | |
860 | 874 | | |
861 | 875 | | |
862 | 876 | | |
863 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
864 | 888 | | |
865 | 889 | | |
866 | 890 | | |
| |||
0 commit comments