calloc error: Not enough space

Mar 24, 2015 at 8:44am
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!
Mar 24, 2015 at 8:57am
calloc allocates contiguous memory. Which means if you have enough memory but its not contiguous it will fail.
Mar 24, 2015 at 9:06am
calloc allocates contiguous memory
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.

What size your allocations are?
Last edited on Mar 24, 2015 at 9:55am
Mar 24, 2015 at 9:49am
calloc allocates memory on stack which is severily limited in size.

Isn't calloc just like malloc except that calloc zero-initialize the memory?
Last edited on Mar 24, 2015 at 9:49am
Mar 24, 2015 at 9:54am
You are right, i mixed up with alloca
Mar 25, 2015 at 12:00am
Thanks Very much, I will try to use the memory pool to avoid the error!
Topic archived. No new replies allowed.