realloc but only first few bytes is meaningful
问题 Assume I have used ptr = malloc(old_size); to allocate a memory block with old_size bytes. Only the first header_size bytes is meaningful. I'm going to increase the size to new_size . new_size is greater than old_size and old_size is greater than header_size . before: /- - - - - - - old_size - - - - - - - \ +===============+---------------------+ \-header_size-/ after: /- - - - - - - - - - - - - - - new_size - - - - - - - - - - - - - - - - - - -\ +===============+-----------------------------