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

Wrong usage of WeakHashMap in weak container and weak container store. #506

Open
MrMks opened this issue Sep 8, 2022 · 0 comments
Open
Labels
Bug: Unconfirmed Unsure if the issue/bug is valid.

Comments

@MrMks
Copy link

MrMks commented Sep 8, 2022

WeakHashMap is a weak key but strong value map, but in those files, String is used as the key. String is something will always exist hold by jvm or something exist for a short period. So use string as key can't match your aim.

Because player name may be held by other plugins, using a String as the key here will make WeakHashMap unable to remove those PlayerProfiles in necessary. And, PlayerProfile contains a Player reference, it finally causing a memory leak problem.

To patch this problem, I recommend to remove those profiles manually by invoking remove method on Map of profiles when a player logs out and on Map of containers when a world unload.

(Required information in template has no value here, but if your guys really need them to fix this problem, I will post them in reply.)

@MrMks MrMks added the Bug: Unconfirmed Unsure if the issue/bug is valid. label Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Unconfirmed Unsure if the issue/bug is valid.
Projects
None yet
Development

No branches or pull requests

1 participant