From 008da0ff5eeec0ce9bd1fff0151f003f18f0cdd2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 27 Jun 2015 21:07:43 +0200 Subject: 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. --- intern/cycles/util/util_guarded_allocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/cycles/util/util_guarded_allocator.h b/intern/cycles/util/util_guarded_allocator.h index c4edb172eb8..14a680cf01c 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::allocate(n, hint); #endif -- cgit v1.2.3