diff --git a/src/util/ObjectsPool.hpp b/src/util/ObjectsPool.hpp index de3e30ae..35b3753b 100644 --- a/src/util/ObjectsPool.hpp +++ b/src/util/ObjectsPool.hpp @@ -4,11 +4,16 @@ #include #include #include +#include namespace util { struct AlignedDeleter { void operator()(void* p) const { +#if defined(_WIN32) + _aligned_free(p); +#else std::free(p); +#endif } }; @@ -42,7 +47,11 @@ namespace util { void allocateNew() { std::unique_ptr ptr( +#if defined(_WIN32) + _aligned_malloc(sizeof(T), alignof(T)); +#else std::aligned_alloc(alignof(T), sizeof(T)) +#endif ); freeObjects.push(ptr.get()); objects.push_back(std::move(ptr));