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

Function malloc_heap_destroy

dpdk/lib/eal/common/malloc_heap.c:1381–1403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1379}
1380
1381int
1382malloc_heap_destroy(struct malloc_heap *heap)
1383{
1384 if (heap->alloc_count != 0) {
1385 RTE_LOG(ERR, EAL, "Heap is still in use\n");
1386 rte_errno = EBUSY;
1387 return -1;
1388 }
1389 if (heap->first != NULL || heap->last != NULL) {
1390 RTE_LOG(ERR, EAL, "Heap still contains memory segments\n");
1391 rte_errno = EBUSY;
1392 return -1;
1393 }
1394 if (heap->total_size != 0)
1395 RTE_LOG(ERR, EAL, "Total size not zero, heap is likely corrupt\n");
1396
1397 /* Reset all of the heap but the (hold) lock so caller can release it. */
1398 RTE_BUILD_BUG_ON(offsetof(struct malloc_heap, lock) != 0);
1399 memset(RTE_PTR_ADD(heap, sizeof(heap->lock)), 0,
1400 sizeof(*heap) - sizeof(heap->lock));
1401
1402 return 0;
1403}
1404
1405int
1406rte_eal_malloc_heap_init(void)

Callers 1

rte_malloc_heap_destroyFunction · 0.85

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected