/*------------------------------------------------------------------------------ OSAL_AllocatorFreeMem ------------------------------------------------------------------------------*/ void OSAL_AllocatorFreeMem(OSAL_ALLOCATOR* alloc, OSAL_U32 size, OSAL_U8* bus_data, OSAL_BUS_WIDTH bus_address) { #ifdef ANDROID TRACE("OSAL_AllocatorFreeMem\b"); DWLLinearMem_t info; info.size = size; info.virtualAddress = (u32*)bus_data; info.busAddress = bus_address; DWLFreeLinear(alloc->pdwl, &info); TRACE("OSAL_AllocatorFreeMem %x ok\n", bus_address); return; #endif #ifdef MEMALLOCHW assert(alloc->fd_memalloc > 0); assert(alloc->fd_mem > 0); if (bus_address) ioctl(alloc->fd_memalloc, MEMALLOC_IOCSFREEBUFFER, &bus_address); if (bus_data != MAP_FAILED) munmap(bus_data, size); #else #ifdef ASSERT assert(((OSAL_BUS_WIDTH)bus_data) == bus_address); OSAL_U32 sentinel = MEMORY_SENTINEL; assert(memcmp(&bus_data[size], &sentinel, sizeof(OSAL_U32)) == 0 && "memory corruption detected"); #endif free(bus_data); #endif }
static void gst_dwl_allocator_free (GstAllocator * allocator, GstMemory * mem) { GstDwlAllocator *dwl; GstDwlMemory *dwlmem; dwl = GST_DWL_ALLOCATOR (allocator); dwlmem = (GstDwlMemory *) mem; g_return_if_fail (GST_IS_DWL_ALLOCATOR (mem->allocator)); GST_LOG ("Freeing slice %p", mem); DWLFreeLinear (dwl->dwl, &dwlmem->linearmem); g_slice_free (GstDwlMemory, dwlmem); }