ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/3] ignite git commit: Fixed memory leak in CPP common module.
Date Wed, 09 Sep 2015 13:22:45 GMT
Fixed memory leak in CPP common module.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ebd841f2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ebd841f2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ebd841f2

Branch: refs/heads/master
Commit: ebd841f248b475ea0fa3fe95ee802429fb4298ca
Parents: df1f770
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Sep 9 16:22:45 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Sep 9 16:22:45 2015 +0300

----------------------------------------------------------------------
 modules/platform/src/main/cpp/common/src/java.cpp        |  2 +-
 .../Impl/Unmanaged/UnmanagedCallbacks.cs                 |  2 +-
 .../Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs  | 11 +++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ebd841f2/modules/platform/src/main/cpp/common/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/java.cpp b/modules/platform/src/main/cpp/common/src/java.cpp
index f2cccb6..d08a90d 100644
--- a/modules/platform/src/main/cpp/common/src/java.cpp
+++ b/modules/platform/src/main/cpp/common/src/java.cpp
@@ -2186,7 +2186,7 @@ namespace ignite
             }
 
             JNIEXPORT void JNICALL JniOnStart(JNIEnv *env, jclass cls, jlong envPtr, jobject
proc, jlong memPtr) {
-                IGNITE_SAFE_PROC(env, envPtr, OnStartHandler, onStart, env->NewGlobalRef(proc),
memPtr);
+                IGNITE_SAFE_PROC(env, envPtr, OnStartHandler, onStart, proc, memPtr);
             }
 
             JNIEXPORT void JNICALL JniOnStop(JNIEnv *env, jclass cls, jlong envPtr) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebd841f2/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 9edf2ef..9efaf5f 100644
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -1005,7 +1005,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         {
             SafeCall(() =>
             {
-                var proc0 = new UnmanagedTarget(_ctx, proc);
+                var proc0 = UnmanagedUtils.Acquire(_ctx, proc);
 
                 Ignition.OnStart(proc0, IgniteManager.Memory.Get(memPtr).Stream());
             }, true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebd841f2/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 4bea392..c55d92f 100644
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -116,6 +116,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         private const string ProcProjectionResetMetrics = "IgniteProjectionResetMetrics";
         private const string ProcProjectionOutOpRet = "IgniteProjectionOutOpRet";
 
+        private const string ProcAcquire = "IgniteAcquire";
         private const string ProcRelease = "IgniteRelease";
 
         private const string ProcTxStart = "IgniteTransactionsStart";
@@ -236,6 +237,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         private delegate void QueryCursorIteratorDelegate(void* ctx, void* target);
         private delegate void QueryCursorCloseDelegate(void* ctx, void* target);
 
+        private delegate void* AcquireDelegate(void* ctx, void* target);
         private delegate void ReleaseDelegate(void* target);
 
         private delegate long TransactionsStartDelegate(void* ctx, void* target, int concurrency,
int isolation, long timeout, int txSize);
@@ -357,6 +359,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         private static readonly QueryCursorIteratorDelegate QryCursorIterator;
         private static readonly QueryCursorCloseDelegate QryCursorClose;
 
+        private static readonly AcquireDelegate ACQUIRE;
         private static readonly ReleaseDelegate RELEASE;
 
         private static readonly TransactionsStartDelegate TxStart;
@@ -492,6 +495,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
             QryCursorIterator = CreateDelegate<QueryCursorIteratorDelegate>(ProcQryCursorIterator);
             QryCursorClose = CreateDelegate<QueryCursorCloseDelegate>(ProcQryCursorClose);
 
+            ACQUIRE = CreateDelegate<AcquireDelegate>(ProcAcquire);
             RELEASE = CreateDelegate<ReleaseDelegate>(ProcRelease);
 
             TxStart = CreateDelegate<TransactionsStartDelegate>(ProcTxStart);
@@ -1108,6 +1112,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
                     ", capacity=" + cap + ']');
         }
 
+        internal static IUnmanagedTarget Acquire(UnmanagedContext ctx, void* target)
+        {
+            void* target0 = ACQUIRE(ctx.NativeContext, target);
+
+            return new UnmanagedTarget(ctx, target0);
+        }
+
         internal static void Release(IUnmanagedTarget target)
         {
             RELEASE(target.Target);


Mime
View raw message