[Bf-blender-cvs] [008da0f] master: Cycles: Use aligned blender allocator when using guarded allocation

Sergey Sharybin noreply at git.blender.org
Sat Jun 27 21:10:15 CEST 2015


Commit: 008da0ff5eeec0ce9bd1fff0151f003f18f0cdd2
Author: Sergey Sharybin
Date:   Sat Jun 27 21:07:43 2015 +0200
Branches: master
https://developer.blender.org/rB008da0ff5eeec0ce9bd1fff0151f003f18f0cdd2

Cycles: Use aligned blender allocator when using guarded allocation

This way we solve possible issues caused by regular allocator not being aware of
some classes preferring 16 bytes alignment needed for SSE to work properly. This
caused random crashes during rendering.

Now we always use aligned allocation in GuardedAllocator which shouldn't be any
measurable performance impact and the code is only used by developers after
defining special symbol, so there is no impact on release builds at all.

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

M	intern/cycles/util/util_guarded_allocator.h

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

diff --git a/intern/cycles/util/util_guarded_allocator.h b/intern/cycles/util/util_guarded_allocator.h
index c4edb17..14a680c 100644
--- a/intern/cycles/util/util_guarded_allocator.h
+++ b/intern/cycles/util/util_guarded_allocator.h
@@ -54,7 +54,7 @@ public:
 		util_guarded_mem_alloc(n * sizeof(T));
 #ifdef WITH_BLENDER_GUARDEDALLOC
 		(void)hint;
-		return (T*)MEM_mallocN(n * sizeof(T), "Cycles Alloc");
+		return (T*)MEM_mallocN_aligned(n * sizeof(T), 16, "Cycles Alloc");
 #else
 		return std::allocator<T>::allocate(n, hint);
 #endif




More information about the Bf-blender-cvs mailing list