GCAlloc occurs when using Addressables in Player

Using Addressables in StandAlone builds will cause GCAlloc to occur periodically.

Specifically, build with StandAlonePlayer (Windows64) and start Profiler.
After launching the game application, Load some file with Addressables.LoadAssetAsync from AddressablesAsset in local PC.
then, The process called DiagnosticsEventCollectorSingleton.Update() periodically generates 1.1KB of GCAlloc.
This is probably done on a VSync-by-VSync basis.

If Addressables.LoadAssetAsync is never called, this GCAlloc will not occur, but once it is called,
the GCAlloc will continue to occur even if the handle is released.

Is this a specification or an unexpected behavior?
Can you at least tell me that?
Please.

bug?

I’ll flag with the team for some insight. Which version of Addressables are you using?

Thanks reply!

Unity 2020.3.18f1
Addressables 1.18.16

If you want, I will submit bug report and attach a reproducible simple project.

This is caused when Serialising data to be sent from the Player to the Editor in order to display the data in the Event Viewer.

This should only occur when “Send Profiler Events” is enabled in the AddressableAssetSettings.
Do you have this set?

No, Disabled this option.
Also I tried disable to “Log Runtime Exceptions” in the AddressableAssetSettings.
GC will still occur.

I’m a little confused about the issue.
Sometimes it happens when I set it to Disable, and sometimes it doesn’t happen when I set it back to Enable.
I’ll do some more research.

I have to run the “Build > New Build > Default Build Script” once.
Send Profiler Events setting does not seem to be applied.
Is this the intended behavior?

The reason for this is that I encountered the following situation.

  1. enable “Send Profiler Events”, and output Player
    2 GC occurs.
  2. disable “Send Profiler Events” and output Player
  3. GC still occurs
  4. run “Build > New Build > Default Build Script” in Addressables Groups, and output Player
  5. no more GC

We should only be doing this when Profiler events are enabled. This is a bug.
I suspect we can make a simple repro easy enough, but if it proves to be something unexpected causing it then I may take you up on your offer :slight_smile:

You could also do a bug report if you want to keep updated through the bug report. I will post in this thread once we know a release that will have a fix in however.

I looked into it and realised your steps:

The reason for this is that I encountered the following situation.
1. enable “Send Profiler Events”, and output Player
2 GC occurs.
3. disable “Send Profiler Events” and output Player
4. GC still occurs
5. run “Build > New Build > Default Build Script” in Addressables Groups, and output Player
6. no more GC

Yes that is the intended behaviour.
The settings are saved with the build. So if you are running Use Existing build in editor or in a Player build. Then it will be using the settings from the last build you made.

In step 3, even if you disable it you need to make a new build for it to be applied to that build.

I see, thanks!