added garbage collection to obj mgr
This commit is contained in:
parent
9629779b2a
commit
1610813bbe
|
@ -56,6 +56,17 @@ namespace lol
|
|||
return it->second;
|
||||
}
|
||||
|
||||
inline void Return(unsigned int id)
|
||||
{
|
||||
auto it = objects.find(id);
|
||||
|
||||
if (it == objects.end())
|
||||
return;
|
||||
|
||||
if (it->second.use_count() < 3) // I hope I don't forget about this if I ever go multithreaded
|
||||
objects.erase(it);
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectManager() {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue