what happens when tried to free memory allocated by heap manager, which allocates more than asked for?
问题 This question was asked to me in an interview. Suppose char *p=malloc(n) assigns more than n,say N bytes of memory are allocated and free(p) is used to free the memory allocated to p. can heap manager perform such faulty allocation ? what happens now, will n bytes are freed or N bytes are freed? is there any method to find how much memory is freed? EDIT is there any method to find how much memory is freed? better than nothing, mallinfo() can shed some light as pointed by "Fred Larson" 回答1: