title: c++ realloc performance vs malloc
body: <p>First of all, I know that I'm wrong but I don't know what is my mistake.
  According to <a href="http://www.cplusplus.com/reference/cstdlib/realloc/" rel="nofollow noreferrer">this link</a>, about "realloc" it says that </p>
  
  <blockquote>
    <p>The content of the memory block is preserved up to the lesser of the new and old sizes, even if the block is moved to a new location. If the new size is larger, the value of the newly allocated portion is indeterminate.</p>
  </blockquote>
  
  <p>So if we use "realloc" if it wants to allocate new location to data, it will copy previous data to new location. So if this is true I'm curios to know isn't that better to use <code>free</code> + <code>malloc</code> instead of realloc? Because I think copying previous data to new location would not be a good idea when we consider about performance.</p>
  
  <p>Can any one help me to find out that where is my mistake?
  Thanks in advance.</p>