The program goes wrong when it runs for a about one day,the perror shows the message"Not enough space",but there are enough space for the program. I have no idea about the error,hoping for your help,Thanks!
calloc allocates memory on stack which is severily limited in size. Common size is 1MB and could be less than that.
I was mistaken, looks like Yanson answer is close to truth.