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

Caches should be scoped to controllers/singletons #5619

Open
Nerixyz opened this issue Oct 2, 2024 · 0 comments
Open

Caches should be scoped to controllers/singletons #5619

Nerixyz opened this issue Oct 2, 2024 · 0 comments

Comments

@Nerixyz
Copy link
Contributor

Nerixyz commented Oct 2, 2024

Currently, we have some mutable static caches (mainly for emotes/images).


UniqueAccess<std::unordered_map<EmoteId, std::weak_ptr<Emote>>>
twitchEmotesCache_;

This is a good start, but we should go further and periodically clean up these tables (or have some smarter algorithm). It's noteworthy, that weak_ptrs to shared_ptrs allocated with make_shared prevent the underlying storage from being freed when all shared_ptrs go out of scope (the destructor still runs, but the storage is only cleaned up later, see blog).

Loosely related to #2732.

@Nerixyz Nerixyz added the issue-report An issue reported by a user. label Oct 2, 2024
@pajlada pajlada added enhancement and removed issue-report An issue reported by a user. labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants