MCPcopy Create free account
hub / github.com/apache/nuttx / malloc

Function malloc

mm/umm_heap/umm_malloc.c:55–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54#undef malloc
55FAR void *malloc(size_t size)
56{
57#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
58 /* Use memalign() because it implements the sbrk() logic */
59
60 return memalign(sizeof(FAR void *), size);
61#else
62 FAR void *ret;
63
64 /* Use mm_malloc() because it implements the clear */
65
66 ret = mm_malloc(USR_HEAP, size);
67 if (ret == NULL)
68 {
69 set_errno(ENOMEM);
70 }
71 else
72 {
73 mm_notify_pressure(mm_heapfree(USR_HEAP),
74 mm_heapfree_largest(USR_HEAP));
75 }
76
77 return ret;
78#endif
79}

Callers 15

zallocFunction · 0.70
mainFunction · 0.50
my_asprintfFunction · 0.50
mainFunction · 0.50
appendFunction · 0.50
parse_fileFunction · 0.50
my_strndupFunction · 0.50
load_elfFunction · 0.50
create_imageFunction · 0.50
cipher_initFunction · 0.50
appendFunction · 0.50

Calls 5

mm_notify_pressureFunction · 0.85
memalignFunction · 0.70
mm_mallocFunction · 0.50
mm_heapfreeFunction · 0.50
mm_heapfree_largestFunction · 0.50

Tested by

no test coverage detected