Keep in mind that when you allocate a memory block using a new one (or malloc, for that matter), the actual allocated memory block will be larger than what you requested. The memory block will also contain some accounting information, so that when you free the block, it can be easily returned back to the free pool and possibly combined with adjacent free blocks.
When you try to free up any memory that you have not received from the new one, this accounting information will not be there, but the system will act as it is, and the results will be unpredictable (usually bad). A.
Ferruccio Jan 14 '09 at 5:11 2009-01-14 05:11
source share