private static void DeleteUnusedObjects(ConcurrentDictionary <Tuple <GLObject.GLObjectType, int>, int> referenceCountById) { HashSet <Tuple <GLObject.GLObjectType, int> > objectsNoReferences = ReferenceCounting.GetObjectsWithNoReferences(referenceCountById); // Remove and delete associated data for Ids with no more references. foreach (var glObject in objectsNoReferences) { if (referenceCountById.TryRemove(glObject, out int value)) { DeleteIdBasedOnType(glObject); } } }
internal static void RemoveReference(GLObject.GLObjectType type, int id) { ReferenceCounting.RemoveReference(referenceCountByGLObject, new Tuple <GLObject.GLObjectType, int>(type, id)); }