Why use _mm_malloc? (as opposed to _aligned_malloc, alligned_alloc, or posix_memalign)

前端 未结 3 2054
清歌不尽
清歌不尽 2020-12-05 09:48

There are a few options for acquiring an aligned block of memory but they\'re very similar and the issue mostly boils down to what language standard and platforms you\'re ta

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 10:27

    Intel compilers support POSIX (Linux) and non-POSIX (Windows) operating systems, hence cannot rely upon either the POSIX or the Windows function. Thus, a compiler-specific but OS-agnostic solution was chosen.

    C11 is a great solution but Microsoft doesn't even support C99 yet, so who knows if they will ever support C11.

    Update: Unlike the C11/POSIX/Windows allocation functions, the ICC intrinsics include a deallocation function. This allows this API to use a separate heap manager from the default one. I don't know if/when it actually does that, but it can be useful to support this model.

    Disclaimer: I work for Intel but have no special knowledge of these decisions, which happened long before I joined the company.

提交回复
热议问题