calloc() allocates only contiguous memory?

Status
Not open for further replies.

sivamit

Full Member level 4
Joined
Dec 1, 2005
Messages
201
Helped
20
Reputation
40
Reaction score
14
Trophy points
1,298
Activity points
2,651
calloc()

Does calloc() allocate only contiguous memory Or it can allocate non-contiguous also..?


Thanks
 

Re: calloc()

The memory block allocated by a single calloc() call obviously must be contiguous according to the parameters of the function. But successive calls of calloc() may return non contiguous memory blocks, depending on the implementation.
 

calloc()

I think calloc can allocate and initialize memory, if the asked memory is available contiguously where as malloc can allocate even if the memory is not available contiguously but available at different locations.
 

Hi all,
when will malloc allocate non contiguous memory?if it is not contiguous,then there is no need to call the memory as a "block".
So I think, malloc and calloc allocate memory in blocks.two blocks may or may not be contiguous but memory within a block will obviously be contiguous!!!!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…