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

Function rte_malloc_heap_destroy

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

Source from the content-addressed store, hash-verified

626}
627
628int
629rte_malloc_heap_destroy(const char *heap_name)
630{
631 struct malloc_heap *heap = NULL;
632 int ret;
633
634 if (heap_name == NULL ||
635 strnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) == 0 ||
636 strnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) ==
637 RTE_HEAP_NAME_MAX_LEN) {
638 rte_errno = EINVAL;
639 return -1;
640 }
641 rte_mcfg_mem_write_lock();
642
643 /* start from non-socket heaps */
644 heap = find_named_heap(heap_name);
645 if (heap == NULL) {
646 RTE_LOG(ERR, EAL, "Heap %s not found\n", heap_name);
647 rte_errno = ENOENT;
648 ret = -1;
649 goto unlock;
650 }
651 /* we shouldn't be able to destroy internal heaps */
652 if (heap->socket_id < RTE_MAX_NUMA_NODES) {
653 rte_errno = EPERM;
654 ret = -1;
655 goto unlock;
656 }
657 /* sanity checks done, now we can destroy the heap */
658 rte_spinlock_lock(&heap->lock);
659 ret = malloc_heap_destroy(heap);
660 rte_spinlock_unlock(&heap->lock);
661unlock:
662 rte_mcfg_mem_write_unlock();
663
664 return ret;
665}

Callers 4

test_malloc_basicFunction · 0.85
test_reallocFunction · 0.85

Calls 7

strnlenFunction · 0.85
rte_mcfg_mem_write_lockFunction · 0.85
find_named_heapFunction · 0.85
malloc_heap_destroyFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by 4

test_malloc_basicFunction · 0.68
test_reallocFunction · 0.68