[ 
https://issues.apache.org/jira/browse/GEODE-9171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326579#comment-17326579
 ] 

ASF GitHub Bot commented on GEODE-9171:
---------------------------------------

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:
us...@infra.apache.org


> Threads Aren't Being Terminated
> -------------------------------
>
>                 Key: GEODE-9171
>                 URL: https://issues.apache.org/jira/browse/GEODE-9171
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Michael Martell
>            Priority: Major
>              Labels: pull-request-available
>
> For .NET applications using the native client, threads aren't being 
> terminated when the native client Cache is closed. This causes a huge leak of 
> memory which can cause long running apps to crash.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to