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.
The
ResourceManager
type currently holdsshared_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 theResourceManager
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.