I have a List of objects, which can be accessed by multiple users from a WebService. However, the number of objects in the list is steadily growing, so I need some memory management. I would like to clear all elements from the list, which are not used by any user. However, I cannot do this simply by calling the GC, because there is still one reference (the one from the List). And I don't know, how to get the number of references to an object.
So, is there a way, how to clear all objects, that have just one reference? Or get the number of references? Or determine, whether there is no other reference outside the List? Any solution is welcome.