EXP_FUNC void ax_free(void *p, const char* file, int line)
{
	if(p) {
   		debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, p,0, esp_get_free_heap_size());
	   free(p);
	   p = NULL;
   }
   return ;
}
EXP_FUNC void ICACHE_FLASH_ATTR ax_free(void *p, const char* file, int line)
{
	if(p) {
   		debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, p,0, system_get_free_heap_size());
	   free(p);
	   p = NULL;
   }
   return ;
}
EXP_FUNC void * ax_zalloc(size_t s, const char* file, int line)
{
    void *x;

    if ((x = (void*)zalloc(s)) == NULL)
    	exit_now("out of memory %s %d\n", file, line);
    else {
    	debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, x, s, esp_get_free_heap_size());
		//add_mem_info(x, s, file, line);
    	}

    return x;
}
EXP_FUNC void * ICACHE_FLASH_ATTR ax_realloc(void *y, size_t s, const char* file, int line)
{
    void *x;

    if ((x = realloc(y, s)) == NULL)
        exit_now("out of memory %s %d\n", file, line);
    else {
    	debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, x, s, system_get_free_heap_size());	
		//add_mem_info(x, s, file, line);
    	}

    return x;
}
Beispiel #5
0
EXP_FUNC void * ICACHE_FLASH_ATTR ax_zalloc(size_t s, const char* file, int line)
{
    void *x;

    if ((x = (void*)malloc(s)) == NULL)
    	exit_now("out of memory %s %d\n", file, line);
    else {
    	debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, x, s, system_get_free_heap_size());
		memset(x, 0, s);
    	}

    return x;
}
EXP_FUNC void * ax_calloc(size_t n, size_t s, const char* file, int line)
{
    void *x;
	//unsigned total_size =0;
    if ((x = calloc(n, s)) == NULL)
    	exit_now("out of memory %s %d\n", file, line);
    else {
    	debug_now("%s %d point[%p] size[%d] heap[%d]\n", file, line, x, s, esp_get_free_heap_size());
		//total_size = n * s;		 
		//add_mem_info (x, total_size, file, line);
    	}

    return x;
}