Monday, 26 September 2016

c - how does free know the size of memory to be freed?







How does free() know how much memory to be free'd which was earlier allocated by malloc() or calloc()? I mean, both of these functions receive size as parameters, while free only needs the pointer to allocated memory. Then how does free() know that how much to free?

No comments:

Post a Comment