Swift RSS memory consumption is much greater than heap memory

Thanks for sharing! Agreed, other allocators can absolutely give you wins (or losses) depending on what allocation pattern you have. Out of interest, what Linux distro/glibc are you using? Because I've recently heard others who struggled with glibc's default allocator but that was on a fairly old glibc version if I recall correctly.

1 Like
# production
FROM ubuntu:20.04
2 Likes

For future readers, I've run into one issue, and that is when enabling jemalloc interposing for the package-benchmark project, I can't add unit testing on macOS - it works perfectly fine with the same approach on Linux. I've created FB11642043 (@NeoNacho @abertelrud) as it seems Xcode / close source xctest, also does some malloc library interposition and building such unit tests on macOS is currently not possible AFAICT.

I created a trivial branch to reproduce the error:

on Linux 'swift test' works:

ubuntu@swift ~/package-benchmark (reproducible-xcode-test-failure)> swift test
[1/1] Planning buildCompiling plugin Benchmark-Plugin...
Compiling plugin GenerateManualPlugin...
Building for debugging...
[11/11] Linking BenchmarkPackageTests.xctest
Build complete! (1.28s)
Test Suite 'All tests' started at 2022-10-03 17:26:33.699
Test Suite 'debug.xctest' started at 2022-10-03 17:26:33.700
Test Suite 'BenchmarkTests' started at 2022-10-03 17:26:33.700
Test Case 'BenchmarkTests.testBaselineComparison' started at 2022-10-03 17:26:33.700
Not empty. Time (system CPU) Time (user CPU)
Test Case 'BenchmarkTests.testBaselineComparison' passed (0.001 seconds)
Test Suite 'BenchmarkTests' passed at 2022-10-03 17:26:33.701
	 Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'debug.xctest' passed at 2022-10-03 17:26:33.701
	 Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'All tests' passed at 2022-10-03 17:26:33.701
	 Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
ubuntu@swift ~/package-benchmark (reproducible-xcode-test-failure)> 

while on macOS we crash:

...
[147/147] Linking BenchmarkPackageTests
Build complete! (14.14s)
error: Exited with signal code 11
hassila@max /t/package-benchmark (reproducible-xcode-test-failure) [1]> 

(so there's an issue with interposing in the specific case of using Xcode/xctest on macOS - but works great on Ubuntu)

1 Like