void abx_mem_exit() { #ifdef ABOX_MEM_ALLOC //check for memory leak //free the dync memory #ifdef DYNC_MEM_INIT #ifdef AVOS if(mem_small) { AVMem_free(mem_small); mem_small = NULL; } if(mem_mid) { AVMem_free(mem_mid); mem_mid = NULL; } if(mem_large) { AVMem_free(mem_large); mem_large = NULL; } if(mem_supper) { AVMem_free(mem_supper); mem_supper = NULL; } #else if(mem_small) { free(mem_small); mem_small = NULL; } if(mem_mid) { free(mem_mid); mem_mid = NULL; } if(mem_large) { free(mem_large); mem_large = NULL; } if(mem_supper) { free(mem_supper); mem_supper = NULL; } #endif #endif #endif }
static void uvideofmt_release(control_t* cntl) { uvideofmt_t* uvideofmt = (uvideofmt_t *)(cntl->private_data); if(uvideofmt) { AVMem_free(uvideofmt); } }
void abx_mem_check_free( void *buf) { size_t old_size; INT8U* ptr = buf; int i; DECLARE_CPU_SR; if(ptr == NULL) { printf("abx_mem_free1\n"); while(1); } if ((u32_t)ptr % 4) { printf("abx_mem_free2\n"); while(1); } ptr -= 20; if((u32_t)ptr < ABX_MIN_MEM_PTR) { printf("abx_mem_free3\n"); while(1); } if((u32_t)ptr >= ABX_MAX_MEM_PTR) { printf("abx_mem_free4\n"); while(1); } if(memcmp(ptr, &mem_magic_head, 4)) { printf("abx_mem_free5\n"); while(1); } *(u32_t*)(ptr) = mem_free_magic_head; old_size = *(u32_t*)(ptr+4); if(memcmp(ptr + 20 + old_size, &mem_magic_tail, 4)) { printf("abx_mem_free6\n"); while(1); } memcpy(ptr + 20 + old_size, &mem_free_magic_tail, 4); if(g_abx_mem_used < old_size) { printf("abx_mem_free7\n"); while(1); } //his OS_ENTER_CRITICAL(); for(i=0; i< ABX_MEM_HIS_SIZE; i++) { if(g_abx_mem_his[i] == (abx_mem_struct_type*)ptr) { g_abx_mem_his[i] = NULL; g_abx_mem_his_used--; break; } } g_abx_mem_used -= old_size; OS_EXIT_CRITICAL(); if(i >= ABX_MEM_HIS_SIZE) { printf("abx_mem_free(his1)\n"); while(1); } AVMem_free(ptr); }