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

fix: combined avatar mesh leak #1230

Merged
merged 3 commits into from Sep 21, 2021
Merged

Conversation

BrianAmadori
Copy link
Contributor

@BrianAmadori BrianAmadori commented Sep 21, 2021

What does this PR change?

  • Combined avatar meshes were leaking because the renderer used to retrieve the mesh references for unload was being destroyed before the unload was called.
  • Fix unhandled error when the face wearables can't be fetched from wearables endpoint.

How to test the changes?

  • Instance many avatars by using clientDebug.InstantiateBotsAtCoords({ amount: 200 })
  • Clear the bots by using clientDebug.ClearBots().

Notice that when doing this in master a lot of dangling meshes can be seen on Unity's profiler, incurring a leak of around 2.4 mb per avatar.

On the version of this PR, the meshes should be destroyed and the memory freed.

Our Code Review Standards

https://github.com/decentraland/unity-renderer/blob/master/docs/code-review-standards.md

@BrianAmadori BrianAmadori self-assigned this Sep 21, 2021
@github-actions
Copy link
Contributor

Copy link
Collaborator

@Kinerius Kinerius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, there is an unintended if with nothing in it.

@@ -415,6 +424,10 @@ private IEnumerator LoadAvatar()
// TODO(Brian): Evaluate using UniTask<T> instead of this way.
yield return new WaitUntil(() => bodyShapeController.isReady && wearableControllers.Values.All(x => x.isReady));

if ( eyesController == null || eyebrowsController == null || mouthController == null )
{
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to delete this

Copy link
Member

@pravusjif pravusjif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with no problems! let's just address Kinerius comment

@BrianAmadori BrianAmadori enabled auto-merge (squash) September 21, 2021 20:44
@BrianAmadori BrianAmadori merged commit a9209b8 into master Sep 21, 2021
@BrianAmadori BrianAmadori deleted the fix/combined-avatar-mesh-leak branch September 21, 2021 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants