[arrayfire] 51/75: Exit early when destructor is called on empty arrays.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:16 UTC 2016


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

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 6325406afa60d5d98a2c4e349fb92e994b33fbab
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Feb 22 16:42:11 2016 -0500

    Exit early when destructor is called on empty arrays.
    
    This should speed things up when a lot of buffers are
    present in the MemoryManager.
---
 src/backend/MemoryManager.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/backend/MemoryManager.cpp b/src/backend/MemoryManager.cpp
index a2bbb7d..5910eab 100644
--- a/src/backend/MemoryManager.cpp
+++ b/src/backend/MemoryManager.cpp
@@ -92,6 +92,9 @@ void MemoryManager::garbageCollect()
 
 void MemoryManager::unlock(void *ptr, bool user_unlock)
 {
+    // Shortcut for empty arrays
+    if (!ptr) return;
+
     lock_guard_t lock(this->memory_mutex);
     memory_info& current = this->getCurrentMemoryInfo();
 

-- 
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