[arrayfire] 145/284: Reverse conditions for freeing in memory managers

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit dbe861ebea0ad871349d5659e8bbc890efacd151
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Fri Jan 1 12:45:54 2016 -0500

    Reverse conditions for freeing in memory managers
---
 src/backend/cpu/memory.cpp    |  6 +++---
 src/backend/cuda/memory.cpp   | 12 ++++++------
 src/backend/opencl/memory.cpp | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/backend/cpu/memory.cpp b/src/backend/cpu/memory.cpp
index 046e897..e2204ec 100644
--- a/src/backend/cpu/memory.cpp
+++ b/src/backend/cpu/memory.cpp
@@ -98,10 +98,10 @@ void garbageCollect()
     mem_iter memory_end  = memory_map.end();
 
     while(memory_curr != memory_end) {
-        if (!(memory_curr->second.mngr_lock) && !memory_curr->second.user_lock) {
-            memory_map.erase(memory_curr++);
-        } else {
+        if (memory_curr->second.mngr_lock || memory_curr->second.user_lock) {
             ++memory_curr;
+        } else {
+            memory_map.erase(memory_curr++);
         }
     }
 }
diff --git a/src/backend/cuda/memory.cpp b/src/backend/cuda/memory.cpp
index 4937ddd..5260950 100644
--- a/src/backend/cuda/memory.cpp
+++ b/src/backend/cuda/memory.cpp
@@ -189,10 +189,10 @@ namespace cuda
         mem_iter memory_end  = memory_maps[n].end();
 
         while(memory_curr != memory_end) {
-            if (!(memory_curr->second.mngr_lock) && !(memory_curr->second.user_lock)) {
-                memory_maps[n].erase(memory_curr++);
-            } else {
+            if (memory_curr->second.mngr_lock || memory_curr->second.user_lock) {
                 ++memory_curr;
+            } else {
+                memory_maps[n].erase(memory_curr++);
             }
         }
     }
@@ -363,10 +363,10 @@ namespace cuda
         mem_iter memory_end  = pinned_maps.end();
 
         while(memory_curr != memory_end) {
-            if (!(memory_curr->second.mngr_lock)) {
-                pinned_maps.erase(memory_curr++);
-            } else {
+            if (memory_curr->second.mngr_lock) {
                 ++memory_curr;
+            } else {
+                pinned_maps.erase(memory_curr++);
             }
         }
     }
diff --git a/src/backend/opencl/memory.cpp b/src/backend/opencl/memory.cpp
index 1ba4ce1..c37ae2a 100644
--- a/src/backend/opencl/memory.cpp
+++ b/src/backend/opencl/memory.cpp
@@ -97,10 +97,10 @@ namespace opencl
         mem_iter memory_end  = memory_maps[n].end();
 
         while(memory_curr != memory_end) {
-            if (!memory_curr->second.mngr_lock && !memory_curr->second.user_lock) {
-                memory_curr = memory_maps[n].erase(memory_curr);
-            } else {
+            if (memory_curr->second.mngr_lock || memory_curr->second.user_lock) {
                 ++memory_curr;
+            } else {
+                memory_maps[n].erase(memory_curr++);
             }
         }
     }
@@ -311,10 +311,10 @@ namespace opencl
         pinned_iter memory_end  = pinned_maps[n].end();
 
         while(memory_curr != memory_end) {
-            if (!memory_curr->second.info.mngr_lock) {
-                memory_curr = pinned_maps[n].erase(memory_curr);
-            } else {
+            if (memory_curr->second.info.mngr_lock) {
                 ++memory_curr;
+            } else {
+                memory_curr = pinned_maps[n].erase(memory_curr);
             }
         }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list