Function randomx_alloc_cache

Source
pub unsafe extern "C" fn randomx_alloc_cache(
    flags: randomx_flags,
) -> *mut randomx_cache
Expand description

Creates a randomx_cache structure and allocates memory for RandomX Cache.

    @param flags is any combination of these 2 flags (each flag can be set or not set):
            RANDOMX_FLAG_LARGE_PAGES - allocate memory in large pages
            RANDOMX_FLAG_JIT - create cache structure with JIT compilation support; this makes
                               subsequent Dataset initialization faster
    Optionally, one of these two flags may be selected:
            RANDOMX_FLAG_ARGON2_SSSE3 - optimized Argon2 for CPUs with the SSSE3 instruction set
                                        makes subsequent cache initialization faster
            RANDOMX_FLAG_ARGON2_AVX2 - optimized Argon2 for CPUs with the AVX2 instruction set
                                       makes subsequent cache initialization faster

    @return Pointer to an allocated randomx_cache structure.
            Returns NULL if:
                     (1) memory allocation fails
                     (2) the RANDOMX_FLAG_JIT is set and JIT compilation is not supported on the current platform
                     (3) an invalid or unsupported RANDOMX_FLAG_ARGON2 value is set