From 4113d99e208e0cd1eb72ef135335c8e274ef02d0 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 6 Nov 2018 10:17:41 -0500 Subject: [PATCH] On MSVC, use aligned malloc and free --- gtsam/nonlinear/Expression-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/nonlinear/Expression-inl.h b/gtsam/nonlinear/Expression-inl.h index 22172e44f..0ba2ad446 100644 --- a/gtsam/nonlinear/Expression-inl.h +++ b/gtsam/nonlinear/Expression-inl.h @@ -200,7 +200,7 @@ T Expression::valueAndJacobianMap(const Values& values, // allocated on Visual Studio. For more information see the issue below // https://bitbucket.org/gtborg/gtsam/issue/178/vlas-unsupported-in-visual-studio #ifdef _MSC_VER - internal::ExecutionTraceStorage* traceStorage = new internal::ExecutionTraceStorage[size]; + auto traceStorage = static_cast(_aligned_malloc(size, internal::TraceAlignment)); #else internal::ExecutionTraceStorage traceStorage[size]; #endif @@ -210,7 +210,7 @@ T Expression::valueAndJacobianMap(const Values& values, trace.startReverseAD1(jacobians); #ifdef _MSC_VER - delete[] traceStorage; + _aligned_free(traceStorage); #endif return value;