MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_zmalloc_socket

Function rte_zmalloc_socket

dpdk/lib/eal/common/rte_malloc.c:108–132  ·  view source on GitHub ↗

* Allocate zero'd memory on specified heap. */

Source from the content-addressed store, hash-verified

106 * Allocate zero'd memory on specified heap.
107 */
108void *
109rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
110{
111 void *ptr = rte_malloc_socket(type, size, align, socket);
112
113 if (ptr != NULL) {
114 struct malloc_elem *elem = malloc_elem_from_data(ptr);
115
116 if (elem->dirty) {
117 memset(ptr, 0, size);
118 } else {
119#ifdef RTE_MALLOC_DEBUG
120 /*
121 * If DEBUG is enabled, then freed memory is marked
122 * with a poison value and set to zero on allocation.
123 * If DEBUG is disabled then memory is already zeroed.
124 */
125 memset(ptr, 0, size);
126#endif
127 }
128 }
129
130 rte_eal_trace_mem_zmalloc(type, size, align, socket, ptr);
131 return ptr;
132}
133
134/*
135 * Allocate zero'd memory on default heap.

Callers 15

rte_lpm6_createFunction · 0.85
rte_lpm_createFunction · 0.85
rte_mempool_cache_createFunction · 0.85
dir24_8_createFunction · 0.85
rte_fib6_createFunction · 0.85
rte_fib_createFunction · 0.85
trie_createFunction · 0.85
rte_sched_port_configFunction · 0.85
rte_sched_subport_configFunction · 0.85
rte_rawdev_pmd_allocateFunction · 0.85
dma_allocate_primaryFunction · 0.85
rte_member_create_sketchFunction · 0.85

Calls 3

rte_malloc_socketFunction · 0.85
malloc_elem_from_dataFunction · 0.85
memsetFunction · 0.85

Tested by 15

main_loopFunction · 0.68
main_loopFunction · 0.68
main_loopFunction · 0.68
test19Function · 0.68
test20Function · 0.68
test21Function · 0.68
virtual_ethdev_createFunction · 0.68