sentence: if a language supports automatic garbage collection ( for instance , java or c# ) , then smart pointers are not needed for the reclamation and safety aspects of memory management , but are nevertheless useful for other purposes , such as cache data structure residence management and resource management of objects such as file handle or network socket .