Search Issue Tracker
By Design
Votes
0
Found in
2020.3.48f1
2023.2.0a21
2023.3.0a1
Issue ID
UUM-42213
Regression
Yes
[WebGL] Deep Profiler not respecting Command line memory allocation over-ride.
h3. *CONTEXT:*
There is a bug in Unity's Deep profiling system which is causing Integer overflow when a Memory allocation value is assigned via Hub's Command Line argument.
The ticket for which is opened here:
https://jira.unity3d.com/browse/UUM-42210
Above bug has a cascading Halo affect on *WebGL Platform:*
When assigning a mem-allocation value via the Hub's command line, after a project is "built to run" with Deep profiling (dev build) enabled, the end output completely (attached to browser) {color:#de350b}*fails to respect the original command line value assigned via Hub.*{color}
Example here:
!image-2023-07-07-17-51-49-260.png|width=925,height=394!
----
h3. *Steps to Repo:*
1. Open empty project (like BiRP 2D) with a command line argument of:
*-profiler-maxusedmemory 20000000*
2. Attach the *provided Profiler debug script* to any in-scene game object like the camera, *_switch to WebGL Platform_ and Hit play.*
3. Observe the console debug log O/P stating the value to be *"Profiler Memory allocation: 20000000"*
4. On the Console window, remove the check box which says "Clear on build" and "Clear on Play"
*!image-2023-07-07-18-01-25-011.png|width=162,height=102!*
5. Build to run in Dev mode with Attached profiler, with following settings:
*!image-2023-07-07-18-03-12-568.png|width=244,height=260!*
6. Once the default browser opens, press CTRL+SHIFT+I (on chrome/firefox) or equivalent to open dev console{*}, wait for project to complete load.{*}
7. Observe the console log in the browser, its should state a value like *"Profiler Memory allocation: 16777216"*
**
----
h3. The following cases are same as ones for Deep Profiling ticket and should be dealt with:
> *-profiler-maxusedmemory* should be limited to Int32.maxValue as per [C# documentation|https://learn.microsoft.com/en-us/dotnet/api/system.int32.maxvalue?view=net-7.0].
> *Edge case:* where *Profiler.maxUsedMemory* can be set to 0, and its allowed. But this value gets' over-ridden in WebGL magically.
!image-2023-07-07-18-34-42-271.png|width=993,height=354!
> *Profiler.maxUsedMemory can be set to -1;*
> Documentation should be updated to reflect above fixes.
Note: The bug does not happen if *Profiler.maxUsedMemory is set in C# above the magical stated value of 1 and Int32.MaxValue.*
**
----
*Other side effects/Instablity caused due to this bug:*
> In a project once deep profile reaches insufficient memory, the Editor console spams with :
#
{quote} {{Change of state for unknown Category ID %d}}
{quote}
#
{quote}Unknown macro:
Unknown macro: \{ Unknown macro}
}
{quote}
#
{quote}Unknown macro:
Unknown macro: \{ Unknown macro}
}
{quote}
> There is a 30-40% chance that the tab does not even load, the Chrome popup saying "do you want to wait/kill" shows up. I am not able to reliably repo this aspect.
> There is a chance where the Profiler just wont even auto-connect (can't get to repo this reliably either, but it happens).
----
*Regression note:* This bug was found in *2023.2.0a21* and I backtracked to *2020.3.48f1* (viz. LTS at the time or writing) and its happening there too. I don't know how long back since this bug has existed beyond LTS.
This may be happening since 2019 as the thread states [here|https://unity.slack.com/archives/C070AA8N5/p1613647872434000]
There is a forum thread related to same issue [here started in 2019|https://forum.unity.com/threads/deep-profiling-on-webgl-unity-2019-4.930663/]
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
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
- Scene view has Y coordinates of the Screen Position node flipped when some of the URP features are disabled
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
Resolution Note:
This feature is behaving as designed. We are investigating new features that could potentially assist in overriding the desired values on a per-build basis. We will share more details as able.