MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / mspace_malloc

Function mspace_malloc

dlmalloc/dlmalloc.c:4936–4953  ·  view source on GitHub ↗

mspace versions of routines are near-clones of the global versions. This is not so nice but better than the alternatives. */

Source from the content-addressed store, hash-verified

4934 versions. This is not so nice but better than the alternatives.
4935*/
4936void* mspace_malloc(mspace msp, size_t bytes) {
4937 void *mem;
4938 mstate ms = (mstate)msp;
4939 size_t nb = 0;
4940
4941 if (!ok_magic(ms)) {
4942 USAGE_ERROR_ACTION(ms,ms);
4943 return 0;
4944 }
4945
4946 if (!PREACTION(ms)) {
4947 mem = alloc_from_reserved_mem(ms, bytes, &nb);
4948 if (mem == NULL)
4949 mem = sys_alloc(ms, nb, 0);
4950 POSTACTION(ms);
4951 }
4952 return mem;
4953}
4954
4955void mspace_free(mspace msp, void* mem) {
4956 if (mem != 0) {

Callers 4

internal_mspace_reallocFunction · 0.85
comdb2_mallocFunction · 0.85
comdb2ma_create_intFunction · 0.85
comdb2bma_create_traceFunction · 0.85

Calls 2

alloc_from_reserved_memFunction · 0.85
sys_allocFunction · 0.85

Tested by

no test coverage detected