Cycles: Make aligned allocation to respect WITH_BLENDER_GUARDEDALLOC

Title pretty says it all actually. Can only briefly mention that we're
indeed entering that state when after applying some WIP patches having
much fuller statistics about memory usage would help giving exact memory
benefit.
This commit is contained in:
Sergey Sharybin 2015-02-19 01:48:59 +05:00
parent ee9ac4e4fc
commit 0f2adc0817
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,7 @@
*/
#include "util_aligned_malloc.h"
#include "util_guarded_allocator.h"
#include <cassert>
@ -41,6 +42,9 @@ CCL_NAMESPACE_BEGIN
void *util_aligned_malloc(int size, int alignment)
{
#ifdef WITH_BLENDER_GUARDEDALLOC
return MEM_mallocN_aligned(size, alignment, "Cycles Aligned Alloc");
#endif
#ifdef _WIN32
return _aligned_malloc(size, alignment);
#elif defined(__APPLE__)
@ -65,7 +69,11 @@ void *util_aligned_malloc(int size, int alignment)
void util_aligned_free(void *ptr)
{
#ifdef _WIN32
#if defined(WITH_BLENDER_GUARDEDALLOC)
if(ptr != NULL) {
MEM_freeN(ptr);
}
#elif defined(_WIN32)
_aligned_free(ptr);
#else
free(ptr);