[Bf-blender-cvs] [28c20fc3934] master: Memory allocator: use lockfree calls internally

Campbell Barton noreply at git.blender.org
Tue May 22 08:49:13 CEST 2018


Commit: 28c20fc3934b404cbce8a9181ae536803abf9444
Author: Campbell Barton
Date:   Tue May 22 08:45:47 2018 +0200
Branches: master
https://developer.blender.org/rB28c20fc3934b404cbce8a9181ae536803abf9444

Memory allocator: use lockfree calls internally

Was already used in some areas.

===================================================================

M	intern/guardedalloc/intern/mallocn_lockfree_impl.c

===================================================================

diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index 4c6ba0cb256..9575375d90a 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -171,7 +171,7 @@ void *MEM_lockfree_dupallocN(const void *vmemh)
 	void *newp = NULL;
 	if (vmemh) {
 		MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
-		const size_t prev_size = MEM_allocN_len(vmemh);
+		const size_t prev_size = MEM_lockfree_allocN_len(vmemh);
 		if (UNLIKELY(MEMHEAD_IS_MMAP(memh))) {
 			newp = MEM_lockfree_mapallocN(prev_size, "dupli_mapalloc");
 		}
@@ -196,7 +196,7 @@ void *MEM_lockfree_reallocN_id(void *vmemh, size_t len, const char *str)
 
 	if (vmemh) {
 		MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
-		size_t old_len = MEM_allocN_len(vmemh);
+		size_t old_len = MEM_lockfree_allocN_len(vmemh);
 
 		if (LIKELY(!MEMHEAD_IS_ALIGNED(memh))) {
 			newp = MEM_lockfree_mallocN(len, "realloc");
@@ -235,7 +235,7 @@ void *MEM_lockfree_recallocN_id(void *vmemh, size_t len, const char *str)
 
 	if (vmemh) {
 		MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
-		size_t old_len = MEM_allocN_len(vmemh);
+		size_t old_len = MEM_lockfree_allocN_len(vmemh);
 
 		if (LIKELY(!MEMHEAD_IS_ALIGNED(memh))) {
 			newp = MEM_lockfree_mallocN(len, "recalloc");



More information about the Bf-blender-cvs mailing list