Why realloc deadlock after clone syscall?
问题 I have a problem that realloc() deadlocks sometime after clone() syscall. My code is: #include <sched.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #include <linux/types.h> #define CHILD_STACK_SIZE 4096*4 #define gettid() syscall(SYS_gettid) #define log(str) fprintf(stderr, "[pid:%d tid:%d] "str, getpid(),gettid()) int clone_func(void *arg){ int *ptr=(int*)malloc(10); int i; for (i=1; i<200000; i++) ptr = realloc(ptr, sizeof(int)