CV_FINAL

CV_FINAL

OpenCV Mat allocator backed by mimalloc. More…

Inherits from cv::MatAllocator

Public Functions

Name
cv::UMatData *allocate(int dims, const int * sizes, int type, void * data0, size_t * step, cv::AccessFlag , cv::UMatUsageFlags ) const
boolallocate(cv::UMatData * u, cv::AccessFlag , cv::UMatUsageFlags ) const
voiddeallocate(cv::UMatData * u) const

Public Attributes

Name
constexpr size_tkAlignment

Detailed Description

class CV_FINAL;

OpenCV Mat allocator backed by mimalloc.

Structurally identical to OpenCV’s internal StdAllocator, with two targeted improvements:

  1. Aligned allocationmi_malloc_aligned(..., kAlignment) gives every buffer 64-byte alignment, matching the CPU cache-line size and the AVX-512 vector width so OpenCV’s IPP/SIMD paths never fall back to a scalar tail.
  2. Aligned row strides – when the allocator owns the buffer (data0 == nullptr) each intermediate stride is padded to kAlignment, so every scanline (and each inner hyperplane of an N-D array) begins at an aligned address, letting vectorised kernels skip per-row masking.

mimalloc’s thread-local arenas also dramatically cut lock contention in Syntalos’ heavily-threaded, burst-allocation video pipelines compared with the system allocator.

Public Functions Documentation

function allocate

inline cv::UMatData * allocate(
    int dims,
    const int * sizes,
    int type,
    void * data0,
    size_t * step,
    cv::AccessFlag ,
    cv::UMatUsageFlags 
) const

function allocate

inline bool allocate(
    cv::UMatData * u,
    cv::AccessFlag ,
    cv::UMatUsageFlags 
) const

function deallocate

inline void deallocate(
    cv::UMatData * u
) const

Public Attributes Documentation

variable kAlignment

static constexpr size_t kAlignment = 64;

Alignment in bytes: matches the cache-line size and AVX-512 requirements. This works well on amd64 and arm64, where Syntalos is most likely to run (amd64 uses 64-byte cache lines, most arm64 CPUs do to, Apple seems to use 128 byte, but even there 64 will work well, and we are unlikely to run on Apple silicon without a Linux port).


Updated on 2026-03-16 at 19:16:01 +0000