1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2019 Intel Corporation
12 #include <sys/queue.h>
15 #include <rte_common.h>
16 #include <rte_memory.h>
17 #include <rte_per_lcore.h>
18 #include <rte_launch.h>
20 #include <rte_lcore.h>
21 #include <rte_malloc.h>
22 #include <rte_cycles.h>
23 #include <rte_random.h>
24 #include <rte_string_fns.h>
32 is_mem_on_socket(int32_t socket);
35 addr_to_socket(void *addr);
41 * Allocate some dynamic memory from heap (3 areas). Check that areas
42 * don't overlap and that alignment constraints match. This test is
43 * done many times on different lcores simultaneously.
46 /* Test if memory overlaps: return 1 if true, or 0 if false. */
48 is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
50 unsigned long ptr1 = (unsigned long)p1;
51 unsigned long ptr2 = (unsigned long)p2;
53 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
55 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
61 is_aligned(void *p, int align)
63 unsigned long addr = (unsigned long)p;
64 unsigned mask = align - 1;
72 test_align_overlap_per_lcore(__rte_unused void *arg)
74 const unsigned align1 = 8,
78 void *p1 = NULL, *p2 = NULL, *p3 = NULL;
81 for (i = 0; i < N; i++) {
82 p1 = rte_zmalloc("dummy", 1000, align1);
84 printf("rte_zmalloc returned NULL (i=%u)\n", i);
88 for(j = 0; j < 1000 ; j++) {
89 if( *(char *)p1 != 0) {
90 printf("rte_zmalloc didn't zero the allocated memory\n");
94 p2 = rte_malloc("dummy", 1000, align2);
96 printf("rte_malloc returned NULL (i=%u)\n", i);
101 p3 = rte_malloc("dummy", 1000, align3);
103 printf("rte_malloc returned NULL (i=%u)\n", i);
109 if (is_memory_overlap(p1, 1000, p2, 1000)) {
110 printf("p1 and p2 overlaps\n");
113 if (is_memory_overlap(p2, 1000, p3, 1000)) {
114 printf("p2 and p3 overlaps\n");
117 if (is_memory_overlap(p1, 1000, p3, 1000)) {
118 printf("p1 and p3 overlaps\n");
121 if (!is_aligned(p1, align1)) {
122 printf("p1 is not aligned\n");
125 if (!is_aligned(p2, align2)) {
126 printf("p2 is not aligned\n");
129 if (!is_aligned(p3, align3)) {
130 printf("p3 is not aligned\n");
137 rte_malloc_dump_stats(stdout, "dummy");
143 test_reordered_free_per_lcore(__rte_unused void *arg)
145 const unsigned align1 = 8,
152 for (i = 0; i < 30; i++) {
153 p1 = rte_zmalloc("dummy", 1000, align1);
155 printf("rte_zmalloc returned NULL (i=%u)\n", i);
159 for(j = 0; j < 1000 ; j++) {
160 if( *(char *)p1 != 0) {
161 printf("rte_zmalloc didn't zero the allocated memory\n");
165 /* use calloc to allocate 1000 16-byte items this time */
166 p2 = rte_calloc("dummy", 1000, 16, align2);
167 /* for third request use regular malloc again */
168 p3 = rte_malloc("dummy", 1000, align3);
170 printf("rte_malloc returned NULL (i=%u)\n", i);
174 if (is_memory_overlap(p1, 1000, p2, 1000)) {
175 printf("p1 and p2 overlaps\n");
178 if (is_memory_overlap(p2, 1000, p3, 1000)) {
179 printf("p2 and p3 overlaps\n");
182 if (is_memory_overlap(p1, 1000, p3, 1000)) {
183 printf("p1 and p3 overlaps\n");
186 if (!is_aligned(p1, align1)) {
187 printf("p1 is not aligned\n");
190 if (!is_aligned(p2, align2)) {
191 printf("p2 is not aligned\n");
194 if (!is_aligned(p3, align3)) {
195 printf("p3 is not aligned\n");
198 /* try freeing in every possible order */
232 rte_malloc_dump_stats(stdout, "dummy");
237 /* test function inside the malloc lib*/
239 test_str_to_size(void)
245 {{ "5G", (uint64_t)5 * 1024 * 1024 *1024 },
246 {"0x20g", (uint64_t)0x20 * 1024 * 1024 *1024},
247 {"10M", 10 * 1024 * 1024},
248 {"050m", 050 * 1024 * 1024},
254 {"-1", 0}, /* negative values return 0 */
257 {"18446744073709551616", 0} /* ULLONG_MAX + 1 == out of range*/
260 for (i = 0; i < RTE_DIM(test_values); i++)
261 if (rte_str_to_size(test_values[i].str) != test_values[i].value)
267 test_multi_alloc_statistics(void)
270 struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats;
275 /* Dynamically calculate the overhead by allocating one cacheline and
276 * then comparing what was allocated from the heap.
278 rte_malloc_get_socket_stats(socket, &pre_stats);
280 void *dummy = rte_malloc_socket(NULL, RTE_CACHE_LINE_SIZE, 0, socket);
284 rte_malloc_get_socket_stats(socket, &post_stats);
286 /* after subtracting cache line, remainder is overhead */
287 overhead = post_stats.heap_allocsz_bytes - pre_stats.heap_allocsz_bytes;
288 overhead -= RTE_CACHE_LINE_SIZE;
292 /* Now start the real tests */
293 rte_malloc_get_socket_stats(socket, &pre_stats);
295 void *p1 = rte_malloc_socket("stats", size , align, socket);
299 rte_malloc_dump_stats(stdout, "stats");
301 rte_malloc_get_socket_stats(socket,&post_stats);
302 /* Check statistics reported are correct */
303 /* All post stats should be equal to pre stats after alloc freed */
304 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
305 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
306 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
307 (post_stats.alloc_count!=pre_stats.alloc_count)&&
308 (post_stats.free_count!=pre_stats.free_count)) {
309 printf("Malloc statistics are incorrect - freed alloc\n");
312 /* Check two consecutive allocations */
315 rte_malloc_get_socket_stats(socket,&pre_stats);
316 void *p2 = rte_malloc_socket("add", size ,align, socket);
319 rte_malloc_get_socket_stats(socket,&first_stats);
321 void *p3 = rte_malloc_socket("add2", size,align, socket);
325 rte_malloc_get_socket_stats(socket,&second_stats);
330 /* After freeing both allocations check stats return to original */
331 rte_malloc_get_socket_stats(socket, &post_stats);
333 if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
334 printf("Incorrect heap statistics: Total size \n");
337 /* Check allocated size is equal to two additions plus overhead */
338 if(second_stats.heap_allocsz_bytes !=
339 size + overhead + first_stats.heap_allocsz_bytes) {
340 printf("Incorrect heap statistics: Allocated size \n");
343 /* Check that allocation count increments correctly i.e. +1 */
344 if (second_stats.alloc_count != first_stats.alloc_count + 1) {
345 printf("Incorrect heap statistics: Allocated count \n");
349 if (second_stats.free_count != first_stats.free_count){
350 printf("Incorrect heap statistics: Free count \n");
354 /* Make sure that we didn't touch our greatest chunk: 2 * 11M) */
355 if (post_stats.greatest_free_size != pre_stats.greatest_free_size) {
356 printf("Incorrect heap statistics: Greatest free size \n");
359 /* Free size must equal the original free size minus the new allocation*/
360 if (first_stats.heap_freesz_bytes <= second_stats.heap_freesz_bytes) {
361 printf("Incorrect heap statistics: Free size \n");
365 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
366 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
367 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
368 (post_stats.alloc_count!=pre_stats.alloc_count)&&
369 (post_stats.free_count!=pre_stats.free_count)) {
370 printf("Malloc statistics are incorrect - freed alloc\n");
377 test_realloc_socket(int socket)
379 const char hello_str[] = "Hello, world!";
380 const unsigned size1 = 1024;
381 const unsigned size2 = size1 + 1024;
382 const unsigned size3 = size2;
383 const unsigned size4 = size3 + 1024;
385 /* test data is the same even if element is moved*/
386 char *ptr1 = rte_zmalloc_socket(
387 NULL, size1, RTE_CACHE_LINE_SIZE, socket);
389 printf("NULL pointer returned from rte_zmalloc\n");
392 strlcpy(ptr1, hello_str, size1);
393 char *ptr2 = rte_realloc_socket(
394 ptr1, size2, RTE_CACHE_LINE_SIZE, socket);
397 printf("NULL pointer returned from rte_realloc\n");
401 printf("unexpected - ptr1 == ptr2\n");
403 if (strcmp(ptr2, hello_str) != 0){
404 printf("Error - lost data from pointed area\n");
409 for (i = strnlen(hello_str, sizeof(hello_str)); i < size1; i++)
411 printf("Bad data in realloc\n");
415 /* now allocate third element, free the second
416 * and resize third. It should not move. (ptr1 is now invalid)
418 char *ptr3 = rte_zmalloc_socket(
419 NULL, size3, RTE_CACHE_LINE_SIZE, socket);
421 printf("NULL pointer returned from rte_zmalloc\n");
425 for (i = 0; i < size3; i++)
427 printf("Bad data in zmalloc\n");
433 /* first resize to half the size of the freed block */
434 char *ptr4 = rte_realloc_socket(
435 ptr3, size4, RTE_CACHE_LINE_SIZE, socket);
437 printf("NULL pointer returned from rte_realloc\n");
442 printf("Unexpected - ptr4 != ptr3\n");
446 /* now resize again to the full size of the freed block */
447 ptr4 = rte_realloc_socket(ptr3, size3 + size2 + size1,
448 RTE_CACHE_LINE_SIZE, socket);
450 printf("Unexpected - ptr4 != ptr3 on second resize\n");
456 /* now try a resize to a smaller size, see if it works */
457 const unsigned size5 = 1024;
458 const unsigned size6 = size5 / 2;
459 char *ptr5 = rte_malloc_socket(
460 NULL, size5, RTE_CACHE_LINE_SIZE, socket);
462 printf("NULL pointer returned from rte_malloc\n");
465 char *ptr6 = rte_realloc_socket(
466 ptr5, size6, RTE_CACHE_LINE_SIZE, socket);
468 printf("NULL pointer returned from rte_realloc\n");
473 printf("Error, resizing to a smaller size moved data\n");
479 /* check for behaviour changing alignment */
480 const unsigned size7 = 1024;
481 const unsigned orig_align = RTE_CACHE_LINE_SIZE;
482 unsigned new_align = RTE_CACHE_LINE_SIZE * 2;
483 char *ptr7 = rte_malloc_socket(NULL, size7, orig_align, socket);
485 printf("NULL pointer returned from rte_malloc\n");
488 /* calc an alignment we don't already have */
489 while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
491 char *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);
493 printf("NULL pointer returned from rte_realloc\n");
497 if (RTE_PTR_ALIGN(ptr8, new_align) != ptr8){
498 printf("Failure to re-align data\n");
504 /* test behaviour when there is a free block after current one,
505 * but its not big enough
507 unsigned size9 = 1024, size10 = 1024;
508 unsigned size11 = size9 + size10 + 256;
509 char *ptr9 = rte_malloc_socket(
510 NULL, size9, RTE_CACHE_LINE_SIZE, socket);
512 printf("NULL pointer returned from rte_malloc\n");
515 char *ptr10 = rte_malloc_socket(
516 NULL, size10, RTE_CACHE_LINE_SIZE, socket);
518 printf("NULL pointer returned from rte_malloc\n");
522 char *ptr11 = rte_realloc_socket(
523 ptr10, size11, RTE_CACHE_LINE_SIZE, socket);
525 printf("NULL pointer returned from rte_realloc\n");
530 printf("Error, unexpected that realloc has not created new buffer\n");
536 /* check we don't crash if we pass null to realloc
537 * We should get a malloc of the size requested*/
538 const size_t size12 = 1024;
540 char *ptr12 = rte_realloc_socket(
541 NULL, size12, RTE_CACHE_LINE_SIZE, socket);
543 printf("NULL pointer returned from rte_realloc\n");
546 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
547 size12_check != size12){
553 /* do the same, but for regular memory */
554 ptr12 = rte_realloc(NULL, size12, RTE_CACHE_LINE_SIZE);
556 printf("NULL pointer returned from rte_realloc\n");
559 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
560 size12_check != size12) {
570 test_realloc_numa(void)
572 /* check realloc_socket part */
573 int32_t socket_count = 0, socket_allocated, socket;
579 for (socket = 0; socket < RTE_MAX_NUMA_NODES; socket++) {
580 if (is_mem_on_socket(socket)) {
585 /* j == 1 -> resizing */
586 ptr2 = rte_realloc_socket(ptr1, size,
590 printf("NULL pointer returned from rte_realloc_socket\n");
595 socket_allocated = addr_to_socket(ptr2);
596 if (socket_allocated != socket) {
597 printf("Requested socket (%d) doesn't mach allocated one (%d)\n",
598 socket, socket_allocated);
601 size += RTE_CACHE_LINE_SIZE;
606 /* Print warnign if only a single socket, but don't fail the test */
607 if (socket_count < 2)
608 printf("WARNING: realloc_socket test needs memory on multiple sockets!\n");
619 const char *heap_name = "realloc_heap";
620 int realloc_heap_socket;
621 unsigned int mem_sz = 1U << 13; /* 8K */
622 unsigned int page_sz = sysconf(_SC_PAGESIZE);
626 /* page size may be bigger than total mem size, so adjust */
627 mem_sz = RTE_MAX(mem_sz, page_sz);
630 * the realloc tests depend on specific layout of underlying memory, so
631 * to prevent accidental failures to do fragmented main heap, we will
632 * do all of our tests on an artificially created memory.
634 if (rte_malloc_heap_create(heap_name) != 0) {
635 printf("Failed to create external heap\n");
639 realloc_heap_socket = rte_malloc_heap_get_socket(heap_name);
641 mem = mmap(NULL, mem_sz, PROT_READ | PROT_WRITE,
642 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
643 if (mem == MAP_FAILED) {
644 printf("Failed to allocate memory for external heap\n");
649 if (rte_malloc_heap_memory_add(
650 heap_name, mem, mem_sz, NULL, 0, page_sz) != 0) {
651 printf("Failed to add memory to external heap\n");
656 /* run the socket-bound tests */
657 ret = test_realloc_socket(realloc_heap_socket);
661 /* now, run the NUMA node tests */
662 ret = test_realloc_numa();
665 rte_malloc_heap_memory_remove(heap_name, mem, mem_sz);
669 rte_malloc_heap_destroy(heap_name);
675 test_random_alloc_free(void *_ __rte_unused)
678 struct mem_list *next;
684 rte_srand((unsigned)rte_rdtsc());
686 for (i = 0; i < N; i++){
687 unsigned free_mem = 0;
688 size_t allocated_size;
690 const unsigned mem_size = sizeof(struct mem_list) + \
691 rte_rand() % (64 * 1024);
692 const unsigned align = 1 << (rte_rand() % 12); /* up to 4k alignment */
693 struct mem_list *entry = rte_malloc(NULL,
697 if (RTE_PTR_ALIGN(entry, align)!= entry)
699 if (rte_malloc_validate(entry, &allocated_size) == -1
700 || allocated_size < mem_size)
702 memset(entry->data, rte_lcore_id(),
703 mem_size - sizeof(*entry));
704 entry->next = list_head;
705 if (rte_malloc_validate(entry, NULL) == -1)
710 /* switch to freeing the memory with a 20% probability */
711 free_mem = ((rte_rand() % 10) >= 8);
714 struct mem_list *entry = list_head;
715 list_head = list_head->next;
719 printf("Lcore %u allocated/freed %u blocks\n", rte_lcore_id(), count);
723 #define err_return() do { \
724 printf("%s: %d - Error\n", __func__, __LINE__); \
729 test_rte_malloc_validate(void)
731 const size_t request_size = 1024;
732 size_t allocated_size;
733 char *data_ptr = rte_malloc(NULL, request_size, RTE_CACHE_LINE_SIZE);
734 #ifdef RTE_MALLOC_DEBUG
736 char *over_write_vals = NULL;
739 if (data_ptr == NULL) {
740 printf("%s: %d - Allocation error\n", __func__, __LINE__);
744 /* check that a null input returns -1 */
745 if (rte_malloc_validate(NULL, NULL) != -1)
748 /* check that we get ok on a valid pointer */
749 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
752 /* check that the returned size is ok */
753 if (allocated_size < request_size)
756 #ifdef RTE_MALLOC_DEBUG
758 /****** change the header to be bad */
760 over_write_vals = (char *)((uintptr_t)data_ptr - sizeof(save_buf));
761 /* first save the data as a backup before overwriting it */
762 memcpy(save_buf, over_write_vals, sizeof(save_buf));
763 memset(over_write_vals, 1, sizeof(save_buf));
764 /* then run validate */
765 retval = rte_malloc_validate(data_ptr, NULL);
766 /* finally restore the data again */
767 memcpy(over_write_vals, save_buf, sizeof(save_buf));
768 /* check we previously had an error */
772 /* check all ok again */
773 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
776 /**** change the trailer to be bad */
777 over_write_vals = (char *)((uintptr_t)data_ptr + allocated_size);
778 /* first save the data as a backup before overwriting it */
779 memcpy(save_buf, over_write_vals, sizeof(save_buf));
780 memset(over_write_vals, 1, sizeof(save_buf));
781 /* then run validate */
782 retval = rte_malloc_validate(data_ptr, NULL);
783 /* finally restore the data again */
784 memcpy(over_write_vals, save_buf, sizeof(save_buf));
788 /* check all ok again */
789 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
803 test_zero_aligned_alloc(void)
805 char *p1 = rte_malloc(NULL,1024, 0);
808 if (!rte_is_aligned(p1, RTE_CACHE_LINE_SIZE))
815 if (p1) rte_free(p1);
820 test_malloc_bad_params(void)
822 const char *type = NULL;
824 unsigned align = RTE_CACHE_LINE_SIZE;
826 /* rte_malloc expected to return null with inappropriate size */
827 char *bad_ptr = rte_malloc(type, size, align);
831 /* rte_realloc expected to return null with inappropriate size */
832 bad_ptr = rte_realloc(NULL, size, align);
836 /* rte_malloc expected to return null with inappropriate alignment */
840 bad_ptr = rte_malloc(type, size, align);
844 /* rte_realloc expected to return null with inappropriate alignment */
845 bad_ptr = rte_realloc(NULL, size, align);
849 #if defined(RTE_CC_GCC) || defined(RTE_CC_CLANG)
850 /* this test can not be built, will get trapped at compile time! */
852 /* rte_malloc expected to return null with size will cause overflow */
853 align = RTE_CACHE_LINE_SIZE;
856 bad_ptr = rte_malloc(type, size, align);
860 bad_ptr = rte_realloc(NULL, size, align);
867 /* clean up pointer */
874 check_socket_mem(const struct rte_memseg_list *msl, void *arg)
876 int32_t *socket = arg;
881 return *socket == msl->socket_id;
884 /* Check if memory is available on a specific socket */
886 is_mem_on_socket(int32_t socket)
888 return rte_memseg_list_walk(check_socket_mem, &socket);
893 * Find what socket a memory address is on. Only works for addresses within
894 * memsegs, not heap or stack...
897 addr_to_socket(void * addr)
899 const struct rte_memseg *ms = rte_mem_virt2memseg(addr, NULL);
900 return ms == NULL ? -1 : ms->socket_id;
904 /* Test using rte_[c|m|zm]alloc_socket() on a specific socket */
906 test_alloc_single_socket(int32_t socket)
908 const char *type = NULL;
909 const size_t size = 10;
910 const unsigned align = 0;
912 int32_t desired_socket = (socket == SOCKET_ID_ANY) ?
913 (int32_t)rte_socket_id() : socket;
915 /* Test rte_calloc_socket() */
916 mem = rte_calloc_socket(type, size, sizeof(char), align, socket);
919 if (addr_to_socket(mem) != desired_socket) {
925 /* Test rte_malloc_socket() */
926 mem = rte_malloc_socket(type, size, align, socket);
929 if (addr_to_socket(mem) != desired_socket) {
934 /* Test rte_zmalloc_socket() */
935 mem = rte_zmalloc_socket(type, size, align, socket);
938 if (addr_to_socket(mem) != desired_socket) {
948 test_alloc_socket(void)
950 unsigned socket_count = 0;
953 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
956 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
957 if (is_mem_on_socket(i)) {
959 if (test_alloc_single_socket(i) < 0) {
960 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
966 if (test_alloc_single_socket(i) == 0) {
967 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
974 /* Print warnign if only a single socket, but don't fail the test */
975 if (socket_count < 2) {
976 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
988 if (test_str_to_size() < 0){
989 printf("test_str_to_size() failed\n");
992 else printf("test_str_to_size() passed\n");
994 if (test_zero_aligned_alloc() < 0){
995 printf("test_zero_aligned_alloc() failed\n");
998 else printf("test_zero_aligned_alloc() passed\n");
1000 if (test_malloc_bad_params() < 0){
1001 printf("test_malloc_bad_params() failed\n");
1004 else printf("test_malloc_bad_params() passed\n");
1006 if (test_realloc() < 0){
1007 printf("test_realloc() failed\n");
1010 else printf("test_realloc() passed\n");
1012 /*----------------------------*/
1013 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1014 rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
1017 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1018 if (rte_eal_wait_lcore(lcore_id) < 0)
1022 printf("test_align_overlap_per_lcore() failed\n");
1025 else printf("test_align_overlap_per_lcore() passed\n");
1027 /*----------------------------*/
1028 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1029 rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
1032 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1033 if (rte_eal_wait_lcore(lcore_id) < 0)
1037 printf("test_reordered_free_per_lcore() failed\n");
1040 else printf("test_reordered_free_per_lcore() passed\n");
1042 /*----------------------------*/
1043 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1044 rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
1047 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1048 if (rte_eal_wait_lcore(lcore_id) < 0)
1052 printf("test_random_alloc_free() failed\n");
1055 else printf("test_random_alloc_free() passed\n");
1057 /*----------------------------*/
1058 ret = test_rte_malloc_validate();
1060 printf("test_rte_malloc_validate() failed\n");
1063 else printf("test_rte_malloc_validate() passed\n");
1065 ret = test_alloc_socket();
1067 printf("test_alloc_socket() failed\n");
1070 else printf("test_alloc_socket() passed\n");
1072 ret = test_multi_alloc_statistics();
1074 printf("test_multi_alloc_statistics() failed\n");
1078 printf("test_multi_alloc_statistics() passed\n");
1083 REGISTER_TEST_COMMAND(malloc_autotest, test_malloc);