mmartell commented on a change in pull request #786:
URL: https://github.com/apache/geode-native/pull/786#discussion_r617601103



##########
File path: clicache/src/Cache.cpp
##########
@@ -57,6 +56,21 @@ namespace Apache
         m_typeRegistry = gcnew Apache::Geode::Client::TypeRegistry(this);
       }
 
+      Cache::~Cache() { //Destructor - deterministic
+        if (!_disposed) {
+          //Clean-up managed resources
+          this->!Cache();
+          _disposed = true;
+          //GC.SuppressFinalize(this) is automatically added here
+          //Base destructor is automatically called too if needed
+        }
+      }
+
+      Cache::!Cache() { //Finalizer - non-deterministic when called by GC
+        //Clean-up unmanaged resources
+        delete m_nativeptr;

Review comment:
       The unmanaged resources are deleted in both the destructor (which calls 
the finalizer) and the finalizer,




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to