Re: free after realloc



OK I deserve the tomatoes. Can I just say, I also have the same man
page (realloc() changes the size ... If the area pointed to was
moved, a free(ptr) is done.) I completely missed the point of the last
sentence.
Q about Lew's code:
x = malloc(100); x = realloc(x, 200);
if realloc fails, x will become NULL and that will leave a 100-byte
hole in the memory, will it not?

.



Relevant Pages

  • Re: How to get the memory block size which allocated by new operator?
    ... memory that not released.When allocate memory by new operator,I will ... set of memory management routines that are far superiour to malloc, realloc, ... Programmers know when they're combining multiple outputs into a single ... NULL is stuffed into pbBuf when realloc returns, destroying the only pointer ...
    (microsoft.public.vc.language)
  • Re: realloc() implicit free() ?
    ... >>> If realloc() finds it necessary to move the memory block, ... > malloc implementations already out there. ... malloc allocates continious memeory i.e one Block while ...
    (comp.lang.c)
  • Re: How to get the memory block size which allocated by new operator?
    ... memory that not released.When allocate memory by new operator,I will ... set of memory management routines that are far superiour to malloc, realloc, ... Programmers know when they're combining multiple outputs into a single ... NULL is stuffed into pbBuf when realloc returns, destroying the only pointer ...
    (microsoft.public.vc.language)
  • Re: Buffer growing strategy?
    ... Oin terms of memory copy performance. ...  Is it possible for a compiler vendor to implement a realloc ... developer to work around the system's implementation. ... tight allocation strategies, which are the norm, you can never know. ...
    (comp.lang.c)
  • Re: realloc() implicit free() ?
    ... >> If we do the realloc then it means that we have allocated the ... >> extended memory for the current memory, ... >> which I extendend to realloc if compiler allocates memory ... >> what is the diffrence between the callocand malloc() ...
    (comp.lang.c)