pub unsafe fn initialize(
memory_type: MemoryType,
flags: MemoryFlags,
) -> Result<()>
Expand description
Specifies a method for FMOD to allocate and free memory, either through user supplied callbacks or through a user supplied memory buffer with a fixed size.
§Safety
This function must be called before any FMOD System object is created.
If MemoryType::Callback::alloc
and MemoryType::Callback::free
are provided without MemoryType::Callback::realloc
the reallocation is implemented via an allocation of the new size, copy from old address to new, then a free of the old address.
Callback implementations must be thread safe.
If you specify a fixed size pool that is too small, FMOD will return FMOD_RESULT::FMOD_ERR_MEMORY
when the limit of the fixed size pool is exceeded.
At this point, it’s possible that FMOD may become unstable. To maintain stability, do not allow FMOD to run out of memory.
To find out the required fixed size call initialize
with an overly large pool size (or no pool) and find out the maximum RAM usage at any one time with get_stats
.
The size of the pool is limited to c_int::MAX
.