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 skin manager leaking client world #469

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

Glease
Copy link
Contributor

@Glease Glease commented Jan 9, 2025

  1. SkinManager store all skin texture in its TextureManager, with ThreadDownloadImageData being image data. Cached skin texture are never flushed (except on game restart).
  2. ThreadDownloadImageData holds onto a reference of IImageBuffer, which is a hybrid of binary data sink and onDownloadFinish callback
  3. This specific subclass of IImageBuffer holds onto a callback object via a synthetic field generated by compiler, as it's an anonymous class.
  4. This callback object should implement SkinAvailableCallback, whose most notable subclass is EntityPlayerSP, which obviously strongly references its World object

This whole chain of reference creates an obscure way to leak the first client world ever loaded (and possibly more if in multiplayer game). I vaguely recall there was one or two other way this first client world is leaked. While I cannot immediately recall the details of every leak, fixing this leak should nonetheless help in the goal of not leaking any one world.

Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
@Glease Glease requested a review from a team January 9, 2025 19:43
@serenibyss serenibyss merged commit 3601891 into master Jan 9, 2025
1 check passed
@serenibyss serenibyss deleted the feature/skinmanagermemoryleak branch January 9, 2025 20:46
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.

2 participants