7

Does Visual Studio C++ 2008/2010 support _mm_malloc officially? It is defined in malloc.h but I can't find its description in the MSDN library.

GManNickG
  • 494,350
  • 52
  • 494
  • 543
Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212

4 Answers4

4

Doesn't answer your question directly, but I think you're suppose to use _aligned_malloc. If my understanding is correct, _mm_malloc is for Intel compilers.

GManNickG
  • 494,350
  • 52
  • 494
  • 543
  • `_mm_malloc` is supported by gcc, and `_aligned_malloc` is not. Microsoft compiler seems to be support it too, but I can't find any official paper about it. – Kirill V. Lyadvinsky Jul 22 '10 at 08:03
  • It's seems to not be officially supported, the msvc "implementation" is just `#define _mm_malloc(a, b) _aligned_malloc(a, b)` so it's pretty much just a matter of whether you want to rely on MS not changing that(a pretty good assumption is they'll keep that around), or provide a similar define when you're compiling for windows. – nos Jan 19 '11 at 20:28
  • It should be noted that `_aligned_alloc` is **NOT** the C11/C++11 `aligned_alloc` : the parameters are inverted and `_aligned_alloc` is not compatible with `free`. – diapir Jun 17 '14 at 20:31
2

_mm_malloc/_mm_free supported in Visual Studio 2013 with using the <malloc.h> header.

rici
  • 234,347
  • 28
  • 237
  • 341
Anton K
  • 4,658
  • 2
  • 47
  • 60
0

See Equivalent C code for _mm_ type functions and, more distantly related, How to allocate aligned memory only using the standard library?

Community
  • 1
  • 1
EmeryBerger
  • 3,897
  • 18
  • 29
0

Doesn't memalign() in <malloc.h> solve this? The man-page says it's obsolete, but ...

Maister
  • 4,978
  • 1
  • 31
  • 34