ImmutableOctet / glare

Glare: Open Source Game Engine written in Modern C++
MIT License
0 stars 0 forks source link

ResourceManager should be partially reworked to use weak references #31

Open ImmutableOctet opened 2 years ago

ImmutableOctet commented 2 years ago

The ResourceManager type currently holds shared_ptr instances, meaning that anything cached will stay allocated even after no one is referencing that resource. There's pros and cons to this, but I think it makes more sense to allow resources to be deallocated naturally, rather than waiting until the ResourceManager instance goes out of scope.

To achieve this, we will need to look at any data structures tied into the existing caching mechanisms, as well as the obvious switch to weak for storage + strong/shared for return-value/query.