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.
This commit is contained in:
Sergey Sharybin 2015-06-27 21:07:43 +02:00
parent 3d7329950e
commit 008da0ff5e

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