Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolver causing 0.8-0.9 MB of GC Allocations per frame in Editor #146

Closed
benjaminOddGames opened this issue Aug 30, 2018 · 10 comments
Closed
Assignees

Comments

@benjaminOddGames
Copy link

benjaminOddGames commented Aug 30, 2018

I'm having an issue where the Resolver is causing a large amount of garbage every frame. This occurs in the editor including when not in play mode, and causes frequent stuttering caused by frequent garbage collections.

The version of Unity is 2018.2.5f1, with the latest Play Services Resolver.
The following profile screenshot was taken with Deep Profile and Profile Editor enabled.

2018-08-30_16-50-18

Other computers in the studio do not have the same issue, though all are using the same version of Unity and Play Services Resolver.

Expanding the profiler gives the following info:
image

@benjaminOddGames benjaminOddGames changed the title 0.8- Resolver causing 0.8-0.9 MB of GC Allocations per frame in Editor Aug 30, 2018
@stewartmiles
Copy link
Contributor

Our code which reads the ABI to check for changes is getting hit each frame...

androidAbisPoller.Poll(AndroidAbis.Current, (previousValue, currentValue) => {

even though an action won't be triggered for a few seconds..

public void Poll(T currentValue, Changed changed) {

Now we have RunOnMainThread, I guess this could be changed to batch up all property checks here

RunOnMainThread.OnUpdate += PollBundleId;
to reduce the GC load.

@Nightro
Copy link

Nightro commented Nov 27, 2018

+1 - couple of us are suffering from this too

@VergilUa
Copy link

VergilUa commented Dec 7, 2018

+1. Please fix this nonsense

@Ospanaattori
Copy link

The fact that this also takes ~10ms per frame on a decent PC is just not acceptable.

@stewartmiles
Copy link
Contributor

Hi everyone, we know this is a problem and it's on the list of things we need to fix. Compared to some other issues we're not getting to it any time soon. So you have a couple of options:

  • Send us a pull request with a fix.
  • Turn off auto-resolution when you're not adding additional plugins to your project. Run Android Resolution when importing plugins that use Android libraries.

@oddgamesdaniel
Copy link
Contributor

oddgamesdaniel commented Dec 14, 2018

You're going to just ignore this massive issue? This issue is rendering the editor borderline unusable due to constant stutters, and causing our game to lock up in editor for well over 10-20 seconds when loading a new scene during play mode. Turning off auto resolution has zero impact on this issue.

@stewartmiles
Copy link
Contributor

@oddgamesdaniel we're not ignoring this issue, it's just prioritized compared to the range of other issues that our team also has to deal with. Remember this plugin is open source, you're free to send us a pull request.

@oddgamesdaniel
Copy link
Contributor

Pull request submitted. It isn't going to remove the underlying cause of the issue, but it should mean that anybody turning off auto resolution won't have to deal with the massive CG allocations every frame

@stewartmiles
Copy link
Contributor

FYI folks, this is what I have working locally. It's down to about 200 bytes of allocation - which still seems a lot to me - every second rather than each frame.

image

@stewartmiles stewartmiles self-assigned this Dec 18, 2018
@oddgamesdaniel
Copy link
Contributor

Thank you, much appreciated!

stewartmiles added a commit that referenced this issue Dec 18, 2018
VersionHandler.FindClass() is called a lot throughout the plugin so this
commit changes the method to memoize the result of each query to remove
any allocation from future searches for the same class.

Some searches would allocate ~500kb, this eliminates this allocation
entirely.

Issue #146
Bug: 121162585

Change-Id: I28c3ddcdce8d2c9645677ca6bbd11acdaa2ed626
@googlesamples googlesamples locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants