2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
14 #include "..\include\vpx_mem.h"
18 #include "..\include\vpx_mem_intrnl.h"
20 void *vpx_mem_alloc(int id
, size_t size
, size_t align
)
22 #if defined CHIP_DM642 || defined __uClinux__
23 void *mem
= (void *)mem_alloc(id
, size
, align
);
29 "*********************************************************\n"
30 "WARNING: mem_alloc returned 0 for id=%p size=%u align=%u.\n"
31 "*********************************************************\n",
33 // should no longer need this. Softier says it's fixed. 2005-01-21 tjf
34 //#if defined __uClinux__
35 //while(1)usleep(1000000);
39 #if defined __uClinux__
40 else if (mem
== (void *)0xFFFFFFFF)
42 // out of memory/error
47 "******************************************************\n"
48 "ERROR: mem_alloc id=%p size=%u align=%u OUT OF MEMORY.\n"
49 "******************************************************\n",
64 void vpx_mem_free(int id
, void *mem
, size_t size
)
66 #if defined CHIP_DM642 || defined __uClinux__
72 "**************************************\n"
73 "WARNING: 0 being free'd id=%p size=%u.\n"
74 "**************************************\n",
77 // should no longer need this. Softier says it's fixed. 2005-01-21 tjf
78 //#if defined __uClinux__
79 //while(1)usleep(1000000);
83 mem_free(id
, mem
, size
);
91 #if CONFIG_MEM_TRACKER
92 void *xvpx_mem_alloc(int id
, size_t size
, size_t align
, char *file
, int line
)
94 void *mem
= vpx_mem_alloc(id
, size
, align
);
96 vpx_memory_tracker_add((size_t)mem
, size
, file
, line
, 0);
101 void xvpx_mem_free(int id
, void *mem
, size_t size
, char *file
, int line
)
103 if (vpx_memory_tracker_remove((size_t)mem
) == -2)
109 _P(fprintf(stderr
, "[vpx_mem][xvpx_mem_free] addr: %p (id=%p size=%u) "
110 "not found in list; freed from file:%s"
111 " line:%d\n", mem
, id
, size
, file
, line
));
114 vpx_mem_free(id
, mem
, size
);
116 #endif /*CONFIG_MEM_TRACKER*/