Search Issue Tracker
Won't Fix
Votes
0
Found in [Package]
1.1.0-pre.1
Issue ID
PROFB-186
Regression
Yes
Memory Profiler captures unknown memory when capturing in a Headless build
Reproduction steps:
1. Open the attached “Test Project” project
2. Open the Build Settings window (File > Build Settings)
3. Select the “Dedicated Server” option under the “Platform” section
4. Build the Project
5. Open the Build in Headless mode
6. Open the Memory Profiler window (Window > Analysis > Memory Profiler)
7. Press the “Capture” button
8. Observe the taken screenshot
Expected result: “Unkown” memory usage is 0 Bytes
Actual result: “Unkown” memory usage is between 0.5-0.7 Gigabytes
Reproducible with: 1.0.0, 1.1.0-pre.3 (2022.2.0a10, 2022.2.21f1, 2022.3.10f1, 2023.1.15f1, 2023.2.0b11, 2023.3.0a7)
Not reproducible with: 0.7.1-preview.1, 1.0.0 (2021.3.30f1, 2022.1.24f1)
Couldn’t test with: 2022.2.0a1-2022.2.0a9 - “Sysroot” package errors
Reproducible on: Ubuntu 22.04, Windows 10
Not reproducible on: No other environment tested
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- GPU utilization increases by 20% on Meta Quest headsets when Render Graph is enabled on 6000.0.16f1 and higher
- Value on Slider (Int) control in UI Builder displays as default when saving UI Document
- Color mismatch in UI Builders Library panel when the Editors theme is set to Light Mode
- [Android ] "AndroidJNI.ToBooleanArray" returns a random non-zero value instead of "IntPtr.Zero" when the method argument is null
- Non-HDR color picker opens when selecting material color with HDR enabled
Resolution Note:
The issue is not a bug, we currently don't track thread stacks.
I've made a feature request to improve it in the future - https://jira.unity3d.com/browse/PROF-2537.
As for the issue itself, it's caused by Linux allocating large chunks of memory for stacks. In my tests, it was 8Mb per thread, with Unity build in default configuration creating ~2.5 threads per core, on 64 core machine ~1.4Gb untracked committed space was allocated just for threads stacks.
The problem can be solved either by `ulimit -s 1024` or by lowering the number of threads. You can lower the number of threads by setting `job-worker-count` / `background-job-worker-count`/`asset-garbage-collectors`, which allows you to control the number of jobs, background jobs and asset GC jobs. (Nb!: Asset GC `asset-garbage-collectors` isn't available in a player build and only works in Editor).