ffmpeg.libavutil.mem

Undocumented in source.

Members

Functions

av_calloc
void* av_calloc(size_t nmemb, size_t size)

Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. The allocation will fail if nmemb * size is greater than or equal to INT_MAX. @param nmemb @param size @return Pointer to the allocated block, NULL if it cannot be allocated.

av_dynarray_add
void av_dynarray_add(void* tab_ptr, int* nb_ptr, void* elem)

Add an element to a dynamic array.

av_free
void av_free(void* ptr)

Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). @param ptr Pointer to the memory block which should be freed. @note ptr = NULL is explicitly allowed. @note It is recommended that you use av_freep() instead. @see av_freep()

av_freep
void av_freep(void* ptr)

Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL. @param ptr Pointer to the pointer to the memory block which should be freed. @see av_free()

av_malloc
void* av_malloc(size_t size)

Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU). @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_mallocz()

av_mallocz
void* av_mallocz(size_t size)

Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if it cannot be allocated. @see av_malloc()

av_max_alloc
void av_max_alloc(size_t max)

Set the maximum size that may me allocated in one block.

av_memcpy_backptr
void av_memcpy_backptr(uint8_t* dst, int back, int cnt)

@brief deliberately overlapping memcpy implementation @param dst destination buffer @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 @param cnt number of bytes to copy, must be >= 0

av_realloc
void* av_realloc(void* ptr, size_t size)

Allocate or reallocate a block of memory. If ptr is NULL and size > 0, allocate a new block. If size is zero, free the memory block pointed to by ptr. @param ptr Pointer to a memory block already allocated with av_malloc(z)() or av_realloc() or NULL. @param size Size in bytes for the memory block to be allocated or reallocated. @return Pointer to a newly reallocated block or NULL if the block cannot be reallocated or the function is used to free the memory block. @see av_fast_realloc()

av_realloc_f
void* av_realloc_f(void* ptr, size_t nelem, size_t elsize)

Allocate or reallocate a block of memory. This function does the same thing as av_realloc, except: - It takes two arguments and checks the result of the multiplication for integer overflow. - It frees the input block in case of failure, thus avoiding the memory leak with the classic "buf = realloc(buf); if (!buf) return -1;".

av_strdup
char* av_strdup(char* s)

Duplicate the string s. @param s string to be duplicated @return Pointer to a newly allocated string containing a copy of s or NULL if the string cannot be allocated.

Static functions

av_malloc_array
void* av_malloc_array(size_t nmemb, size_t size)

Helper function to allocate a block of size * nmemb bytes with using av_malloc() @param nmemb Number of elements @param size Size of the single element @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_malloc()

av_mallocz_array
void* av_mallocz_array(size_t nmemb, size_t size)

Helper function to allocate a block of size * nmemb bytes with using av_mallocz() @param nmemb Number of elements @param size Size of the single element @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_mallocz() @see av_malloc_array()

av_size_mult
int av_size_mult(size_t a, size_t b, size_t* r)

Multiply two size_t values checking for overflow. @return 0 if success, AVERROR(EINVAL) if overflow.

Meta