1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2019 Intel Corporation
13 #ifndef RTE_EXEC_ENV_WINDOWS
16 #include <sys/queue.h>
19 #include <rte_common.h>
20 #include <rte_memory.h>
21 #include <rte_per_lcore.h>
22 #include <rte_launch.h>
24 #include <rte_lcore.h>
25 #include <rte_malloc.h>
26 #include <rte_cycles.h>
27 #include <rte_random.h>
28 #include <rte_string_fns.h>
33 is_mem_on_socket(int32_t socket);
36 addr_to_socket(void *addr);
42 * Allocate some dynamic memory from heap (3 areas). Check that areas
43 * don't overlap and that alignment constraints match. This test is
44 * done many times on different lcores simultaneously.
47 /* Test if memory overlaps: return 1 if true, or 0 if false. */
49 is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
51 uintptr_t ptr1 = (uintptr_t)p1;
52 uintptr_t ptr2 = (uintptr_t)p2;
54 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
56 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
62 is_aligned(void *p, int align)
64 uintptr_t addr = (uintptr_t)p;
65 unsigned mask = align - 1;
73 test_align_overlap_per_lcore(__rte_unused void *arg)
75 const unsigned align1 = 8,
79 void *p1 = NULL, *p2 = NULL, *p3 = NULL;
82 for (i = 0; i < N; i++) {
83 p1 = rte_zmalloc("dummy", 1000, align1);
85 printf("rte_zmalloc returned NULL (i=%u)\n", i);
89 for(j = 0; j < 1000 ; j++) {
90 if( *(char *)p1 != 0) {
91 printf("rte_zmalloc didn't zero the allocated memory\n");
95 p2 = rte_malloc("dummy", 1000, align2);
97 printf("rte_malloc returned NULL (i=%u)\n", i);
102 p3 = rte_malloc("dummy", 1000, align3);
104 printf("rte_malloc returned NULL (i=%u)\n", i);
110 if (is_memory_overlap(p1, 1000, p2, 1000)) {
111 printf("p1 and p2 overlaps\n");
114 if (is_memory_overlap(p2, 1000, p3, 1000)) {
115 printf("p2 and p3 overlaps\n");
118 if (is_memory_overlap(p1, 1000, p3, 1000)) {
119 printf("p1 and p3 overlaps\n");
122 if (!is_aligned(p1, align1)) {
123 printf("p1 is not aligned\n");
126 if (!is_aligned(p2, align2)) {
127 printf("p2 is not aligned\n");
130 if (!is_aligned(p3, align3)) {
131 printf("p3 is not aligned\n");
138 rte_malloc_dump_stats(stdout, "dummy");
144 test_reordered_free_per_lcore(__rte_unused void *arg)
146 const unsigned align1 = 8,
153 for (i = 0; i < 30; i++) {
154 p1 = rte_zmalloc("dummy", 1000, align1);
156 printf("rte_zmalloc returned NULL (i=%u)\n", i);
160 for(j = 0; j < 1000 ; j++) {
161 if( *(char *)p1 != 0) {
162 printf("rte_zmalloc didn't zero the allocated memory\n");
166 /* use calloc to allocate 1000 16-byte items this time */
167 p2 = rte_calloc("dummy", 1000, 16, align2);
168 /* for third request use regular malloc again */
169 p3 = rte_malloc("dummy", 1000, align3);
171 printf("rte_malloc returned NULL (i=%u)\n", i);
175 if (is_memory_overlap(p1, 1000, p2, 1000)) {
176 printf("p1 and p2 overlaps\n");
179 if (is_memory_overlap(p2, 1000, p3, 1000)) {
180 printf("p2 and p3 overlaps\n");
183 if (is_memory_overlap(p1, 1000, p3, 1000)) {
184 printf("p1 and p3 overlaps\n");
187 if (!is_aligned(p1, align1)) {
188 printf("p1 is not aligned\n");
191 if (!is_aligned(p2, align2)) {
192 printf("p2 is not aligned\n");
195 if (!is_aligned(p3, align3)) {
196 printf("p3 is not aligned\n");
199 /* try freeing in every possible order */
233 rte_malloc_dump_stats(stdout, "dummy");
238 /* test function inside the malloc lib*/
240 test_str_to_size(void)
246 {{ "5G", (uint64_t)5 * 1024 * 1024 *1024 },
247 {"0x20g", (uint64_t)0x20 * 1024 * 1024 *1024},
248 {"10M", 10 * 1024 * 1024},
249 {"050m", 050 * 1024 * 1024},
255 {"-1", 0}, /* negative values return 0 */
258 {"18446744073709551616", 0} /* ULLONG_MAX + 1 == out of range*/
261 for (i = 0; i < RTE_DIM(test_values); i++)
262 if (rte_str_to_size(test_values[i].str) != test_values[i].value)
268 test_multi_alloc_statistics(void)
271 struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats;
276 /* Dynamically calculate the overhead by allocating one cacheline and
277 * then comparing what was allocated from the heap.
279 rte_malloc_get_socket_stats(socket, &pre_stats);
281 void *dummy = rte_malloc_socket(NULL, RTE_CACHE_LINE_SIZE, 0, socket);
285 rte_malloc_get_socket_stats(socket, &post_stats);
287 /* after subtracting cache line, remainder is overhead */
288 overhead = post_stats.heap_allocsz_bytes - pre_stats.heap_allocsz_bytes;
289 overhead -= RTE_CACHE_LINE_SIZE;
293 /* Now start the real tests */
294 rte_malloc_get_socket_stats(socket, &pre_stats);
296 void *p1 = rte_malloc_socket("stats", size , align, socket);
300 rte_malloc_dump_stats(stdout, "stats");
302 rte_malloc_get_socket_stats(socket,&post_stats);
303 /* Check statistics reported are correct */
304 /* All post stats should be equal to pre stats after alloc freed */
305 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
306 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
307 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
308 (post_stats.alloc_count!=pre_stats.alloc_count)&&
309 (post_stats.free_count!=pre_stats.free_count)) {
310 printf("Malloc statistics are incorrect - freed alloc\n");
313 /* Check two consecutive allocations */
316 rte_malloc_get_socket_stats(socket,&pre_stats);
317 void *p2 = rte_malloc_socket("add", size ,align, socket);
320 rte_malloc_get_socket_stats(socket,&first_stats);
322 void *p3 = rte_malloc_socket("add2", size,align, socket);
326 rte_malloc_get_socket_stats(socket,&second_stats);
331 /* After freeing both allocations check stats return to original */
332 rte_malloc_get_socket_stats(socket, &post_stats);
334 if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
335 printf("Incorrect heap statistics: Total size \n");
338 /* Check allocated size is equal to two additions plus overhead */
339 if(second_stats.heap_allocsz_bytes !=
340 size + overhead + first_stats.heap_allocsz_bytes) {
341 printf("Incorrect heap statistics: Allocated size \n");
344 /* Check that allocation count increments correctly i.e. +1 */
345 if (second_stats.alloc_count != first_stats.alloc_count + 1) {
346 printf("Incorrect heap statistics: Allocated count \n");
350 if (second_stats.free_count != first_stats.free_count){
351 printf("Incorrect heap statistics: Free count \n");
355 /* Make sure that we didn't touch our greatest chunk: 2 * 11M) */
356 if (post_stats.greatest_free_size != pre_stats.greatest_free_size) {
357 printf("Incorrect heap statistics: Greatest free size \n");
360 /* Free size must equal the original free size minus the new allocation*/
361 if (first_stats.heap_freesz_bytes <= second_stats.heap_freesz_bytes) {
362 printf("Incorrect heap statistics: Free size \n");
366 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
367 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
368 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
369 (post_stats.alloc_count!=pre_stats.alloc_count)&&
370 (post_stats.free_count!=pre_stats.free_count)) {
371 printf("Malloc statistics are incorrect - freed alloc\n");
377 #ifdef RTE_EXEC_ENV_WINDOWS
386 test_realloc_socket(int socket)
388 const char hello_str[] = "Hello, world!";
389 const unsigned size1 = 1024;
390 const unsigned size2 = size1 + 1024;
391 const unsigned size3 = size2;
392 const unsigned size4 = size3 + 1024;
394 /* test data is the same even if element is moved*/
395 char *ptr1 = rte_zmalloc_socket(
396 NULL, size1, RTE_CACHE_LINE_SIZE, socket);
398 printf("NULL pointer returned from rte_zmalloc\n");
401 strlcpy(ptr1, hello_str, size1);
402 char *ptr2 = rte_realloc_socket(
403 ptr1, size2, RTE_CACHE_LINE_SIZE, socket);
406 printf("NULL pointer returned from rte_realloc\n");
410 printf("unexpected - ptr1 == ptr2\n");
412 if (strcmp(ptr2, hello_str) != 0){
413 printf("Error - lost data from pointed area\n");
418 for (i = strnlen(hello_str, sizeof(hello_str)); i < size1; i++)
420 printf("Bad data in realloc\n");
424 /* now allocate third element, free the second
425 * and resize third. It should not move. (ptr1 is now invalid)
427 char *ptr3 = rte_zmalloc_socket(
428 NULL, size3, RTE_CACHE_LINE_SIZE, socket);
430 printf("NULL pointer returned from rte_zmalloc\n");
434 for (i = 0; i < size3; i++)
436 printf("Bad data in zmalloc\n");
442 /* first resize to half the size of the freed block */
443 char *ptr4 = rte_realloc_socket(
444 ptr3, size4, RTE_CACHE_LINE_SIZE, socket);
446 printf("NULL pointer returned from rte_realloc\n");
451 printf("Unexpected - ptr4 != ptr3\n");
455 /* now resize again to the full size of the freed block */
456 ptr4 = rte_realloc_socket(ptr3, size3 + size2 + size1,
457 RTE_CACHE_LINE_SIZE, socket);
459 printf("Unexpected - ptr4 != ptr3 on second resize\n");
465 /* now try a resize to a smaller size, see if it works */
466 const unsigned size5 = 1024;
467 const unsigned size6 = size5 / 2;
468 char *ptr5 = rte_malloc_socket(
469 NULL, size5, RTE_CACHE_LINE_SIZE, socket);
471 printf("NULL pointer returned from rte_malloc\n");
474 char *ptr6 = rte_realloc_socket(
475 ptr5, size6, RTE_CACHE_LINE_SIZE, socket);
477 printf("NULL pointer returned from rte_realloc\n");
482 printf("Error, resizing to a smaller size moved data\n");
488 /* check for behaviour changing alignment */
489 const unsigned size7 = 1024;
490 const unsigned orig_align = RTE_CACHE_LINE_SIZE;
491 unsigned new_align = RTE_CACHE_LINE_SIZE * 2;
492 char *ptr7 = rte_malloc_socket(NULL, size7, orig_align, socket);
494 printf("NULL pointer returned from rte_malloc\n");
497 /* calc an alignment we don't already have */
498 while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
500 char *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);
502 printf("NULL pointer returned from rte_realloc\n");
506 if (RTE_PTR_ALIGN(ptr8, new_align) != ptr8){
507 printf("Failure to re-align data\n");
513 /* test behaviour when there is a free block after current one,
514 * but its not big enough
516 unsigned size9 = 1024, size10 = 1024;
517 unsigned size11 = size9 + size10 + 256;
518 char *ptr9 = rte_malloc_socket(
519 NULL, size9, RTE_CACHE_LINE_SIZE, socket);
521 printf("NULL pointer returned from rte_malloc\n");
524 char *ptr10 = rte_malloc_socket(
525 NULL, size10, RTE_CACHE_LINE_SIZE, socket);
527 printf("NULL pointer returned from rte_malloc\n");
531 char *ptr11 = rte_realloc_socket(
532 ptr10, size11, RTE_CACHE_LINE_SIZE, socket);
534 printf("NULL pointer returned from rte_realloc\n");
539 printf("Error, unexpected that realloc has not created new buffer\n");
545 /* check we don't crash if we pass null to realloc
546 * We should get a malloc of the size requested*/
547 const size_t size12 = 1024;
549 char *ptr12 = rte_realloc_socket(
550 NULL, size12, RTE_CACHE_LINE_SIZE, socket);
552 printf("NULL pointer returned from rte_realloc\n");
555 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
556 size12_check != size12){
562 /* do the same, but for regular memory */
563 ptr12 = rte_realloc(NULL, size12, RTE_CACHE_LINE_SIZE);
565 printf("NULL pointer returned from rte_realloc\n");
568 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
569 size12_check != size12) {
579 test_realloc_numa(void)
581 /* check realloc_socket part */
582 int32_t socket_count = 0, socket_allocated, socket;
588 for (socket = 0; socket < RTE_MAX_NUMA_NODES; socket++) {
589 if (is_mem_on_socket(socket)) {
594 /* j == 1 -> resizing */
595 ptr2 = rte_realloc_socket(ptr1, size,
599 printf("NULL pointer returned from rte_realloc_socket\n");
604 socket_allocated = addr_to_socket(ptr2);
605 if (socket_allocated != socket) {
606 printf("Requested socket (%d) doesn't mach allocated one (%d)\n",
607 socket, socket_allocated);
610 size += RTE_CACHE_LINE_SIZE;
615 /* Print warning if only a single socket, but don't fail the test */
616 if (socket_count < 2)
617 printf("WARNING: realloc_socket test needs memory on multiple sockets!\n");
628 const char *heap_name = "realloc_heap";
629 int realloc_heap_socket;
630 unsigned int mem_sz = 1U << 13; /* 8K */
631 unsigned int page_sz = sysconf(_SC_PAGESIZE);
635 /* page size may be bigger than total mem size, so adjust */
636 mem_sz = RTE_MAX(mem_sz, page_sz);
639 * the realloc tests depend on specific layout of underlying memory, so
640 * to prevent accidental failures to do fragmented main heap, we will
641 * do all of our tests on an artificially created memory.
643 if (rte_malloc_heap_create(heap_name) != 0) {
644 printf("Failed to create external heap\n");
648 realloc_heap_socket = rte_malloc_heap_get_socket(heap_name);
650 mem = mmap(NULL, mem_sz, PROT_READ | PROT_WRITE,
651 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
652 if (mem == MAP_FAILED) {
653 printf("Failed to allocate memory for external heap\n");
658 if (rte_malloc_heap_memory_add(
659 heap_name, mem, mem_sz, NULL, 0, page_sz) != 0) {
660 printf("Failed to add memory to external heap\n");
665 /* run the socket-bound tests */
666 ret = test_realloc_socket(realloc_heap_socket);
670 /* now, run the NUMA node tests */
671 ret = test_realloc_numa();
674 rte_malloc_heap_memory_remove(heap_name, mem, mem_sz);
678 rte_malloc_heap_destroy(heap_name);
683 #endif /* !RTE_EXEC_ENV_WINDOWS */
686 test_random_alloc_free(void *_ __rte_unused)
689 struct mem_list *next;
695 rte_srand((unsigned)rte_rdtsc());
697 for (i = 0; i < N; i++){
698 unsigned free_mem = 0;
699 size_t allocated_size;
701 const unsigned mem_size = sizeof(struct mem_list) + \
702 rte_rand() % (64 * 1024);
703 const unsigned align = 1 << (rte_rand() % 12); /* up to 4k alignment */
704 struct mem_list *entry = rte_malloc(NULL,
708 if (RTE_PTR_ALIGN(entry, align)!= entry)
710 if (rte_malloc_validate(entry, &allocated_size) == -1
711 || allocated_size < mem_size)
713 memset(entry->data, rte_lcore_id(),
714 mem_size - sizeof(*entry));
715 entry->next = list_head;
716 if (rte_malloc_validate(entry, NULL) == -1)
721 /* switch to freeing the memory with a 20% probability */
722 free_mem = ((rte_rand() % 10) >= 8);
725 struct mem_list *entry = list_head;
726 list_head = list_head->next;
730 printf("Lcore %u allocated/freed %u blocks\n", rte_lcore_id(), count);
734 #define err_return() do { \
735 printf("%s: %d - Error\n", __func__, __LINE__); \
740 test_rte_malloc_validate(void)
742 const size_t request_size = 1024;
743 size_t allocated_size;
744 char *data_ptr = rte_malloc(NULL, request_size, RTE_CACHE_LINE_SIZE);
745 #ifdef RTE_MALLOC_DEBUG
747 char *over_write_vals = NULL;
750 if (data_ptr == NULL) {
751 printf("%s: %d - Allocation error\n", __func__, __LINE__);
755 /* check that a null input returns -1 */
756 if (rte_malloc_validate(NULL, NULL) != -1)
759 /* check that we get ok on a valid pointer */
760 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
763 /* check that the returned size is ok */
764 if (allocated_size < request_size)
767 #ifdef RTE_MALLOC_DEBUG
769 /****** change the header to be bad */
771 over_write_vals = (char *)((uintptr_t)data_ptr - sizeof(save_buf));
772 /* first save the data as a backup before overwriting it */
773 memcpy(save_buf, over_write_vals, sizeof(save_buf));
774 memset(over_write_vals, 1, sizeof(save_buf));
775 /* then run validate */
776 retval = rte_malloc_validate(data_ptr, NULL);
777 /* finally restore the data again */
778 memcpy(over_write_vals, save_buf, sizeof(save_buf));
779 /* check we previously had an error */
783 /* check all ok again */
784 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
787 /**** change the trailer to be bad */
788 over_write_vals = (char *)((uintptr_t)data_ptr + allocated_size);
789 /* first save the data as a backup before overwriting it */
790 memcpy(save_buf, over_write_vals, sizeof(save_buf));
791 memset(over_write_vals, 1, sizeof(save_buf));
792 /* then run validate */
793 retval = rte_malloc_validate(data_ptr, NULL);
794 /* finally restore the data again */
795 memcpy(over_write_vals, save_buf, sizeof(save_buf));
799 /* check all ok again */
800 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
814 test_zero_aligned_alloc(void)
816 char *p1 = rte_malloc(NULL,1024, 0);
819 if (!rte_is_aligned(p1, RTE_CACHE_LINE_SIZE))
826 if (p1) rte_free(p1);
831 test_malloc_bad_params(void)
833 const char *type = NULL;
835 unsigned align = RTE_CACHE_LINE_SIZE;
837 /* rte_malloc expected to return null with inappropriate size */
838 char *bad_ptr = rte_malloc(type, size, align);
842 /* rte_realloc expected to return null with inappropriate size */
843 bad_ptr = rte_realloc(NULL, size, align);
847 /* rte_malloc expected to return null with inappropriate alignment */
851 bad_ptr = rte_malloc(type, size, align);
855 /* rte_realloc expected to return null with inappropriate alignment */
856 bad_ptr = rte_realloc(NULL, size, align);
860 #if defined(RTE_CC_GCC) || defined(RTE_CC_CLANG)
861 /* this test can not be built, will get trapped at compile time! */
863 /* rte_malloc expected to return null with size will cause overflow */
864 align = RTE_CACHE_LINE_SIZE;
867 bad_ptr = rte_malloc(type, size, align);
871 bad_ptr = rte_realloc(NULL, size, align);
878 /* clean up pointer */
885 check_socket_mem(const struct rte_memseg_list *msl, void *arg)
887 int32_t *socket = arg;
892 return *socket == msl->socket_id;
895 /* Check if memory is available on a specific socket */
897 is_mem_on_socket(int32_t socket)
899 return rte_memseg_list_walk(check_socket_mem, &socket);
904 * Find what socket a memory address is on. Only works for addresses within
905 * memsegs, not heap or stack...
908 addr_to_socket(void * addr)
910 const struct rte_memseg *ms = rte_mem_virt2memseg(addr, NULL);
911 return ms == NULL ? -1 : ms->socket_id;
915 /* Test using rte_[c|m|zm]alloc_socket() on a specific socket */
917 test_alloc_single_socket(int32_t socket)
919 const char *type = NULL;
920 const size_t size = 10;
921 const unsigned align = 0;
923 int32_t desired_socket = (socket == SOCKET_ID_ANY) ?
924 (int32_t)rte_socket_id() : socket;
926 /* Test rte_calloc_socket() */
927 mem = rte_calloc_socket(type, size, sizeof(char), align, socket);
930 if (addr_to_socket(mem) != desired_socket) {
936 /* Test rte_malloc_socket() */
937 mem = rte_malloc_socket(type, size, align, socket);
940 if (addr_to_socket(mem) != desired_socket) {
945 /* Test rte_zmalloc_socket() */
946 mem = rte_zmalloc_socket(type, size, align, socket);
949 if (addr_to_socket(mem) != desired_socket) {
959 test_alloc_socket(void)
961 unsigned socket_count = 0;
964 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
967 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
968 if (is_mem_on_socket(i)) {
970 if (test_alloc_single_socket(i) < 0) {
971 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
977 if (test_alloc_single_socket(i) == 0) {
978 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
985 /* Print warning if only a single socket, but don't fail the test */
986 if (socket_count < 2) {
987 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
999 if (test_str_to_size() < 0){
1000 printf("test_str_to_size() failed\n");
1003 else printf("test_str_to_size() passed\n");
1005 if (test_zero_aligned_alloc() < 0){
1006 printf("test_zero_aligned_alloc() failed\n");
1009 else printf("test_zero_aligned_alloc() passed\n");
1011 if (test_malloc_bad_params() < 0){
1012 printf("test_malloc_bad_params() failed\n");
1015 else printf("test_malloc_bad_params() passed\n");
1017 if (test_realloc() < 0){
1018 printf("test_realloc() failed\n");
1021 else printf("test_realloc() passed\n");
1023 /*----------------------------*/
1024 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1025 rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
1028 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1029 if (rte_eal_wait_lcore(lcore_id) < 0)
1033 printf("test_align_overlap_per_lcore() failed\n");
1036 else printf("test_align_overlap_per_lcore() passed\n");
1038 /*----------------------------*/
1039 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1040 rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
1043 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1044 if (rte_eal_wait_lcore(lcore_id) < 0)
1048 printf("test_reordered_free_per_lcore() failed\n");
1051 else printf("test_reordered_free_per_lcore() passed\n");
1053 /*----------------------------*/
1054 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1055 rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
1058 RTE_LCORE_FOREACH_WORKER(lcore_id) {
1059 if (rte_eal_wait_lcore(lcore_id) < 0)
1063 printf("test_random_alloc_free() failed\n");
1066 else printf("test_random_alloc_free() passed\n");
1068 /*----------------------------*/
1069 ret = test_rte_malloc_validate();
1071 printf("test_rte_malloc_validate() failed\n");
1074 else printf("test_rte_malloc_validate() passed\n");
1076 ret = test_alloc_socket();
1078 printf("test_alloc_socket() failed\n");
1081 else printf("test_alloc_socket() passed\n");
1083 ret = test_multi_alloc_statistics();
1085 printf("test_multi_alloc_statistics() failed\n");
1089 printf("test_multi_alloc_statistics() passed\n");
1094 REGISTER_TEST_COMMAND(malloc_autotest, test_malloc);