realloc, copy and VM




When you realloc for more size, it may be necessary to allocate a new block,
copy memory and deallocate the old, for example if there is not enough free
space after the original block (maybe the only example ?). But, is it really
necessary to _copy_ bytes ? When in a virtual memory environment (off-topic
here, be I still think the question is worth), you don't access directly
physical memory, but allocated pages, so would it be possible on some
implementations, to just change page allocation ? Some kind of immobile
trip. It could permit optimizations even when not knowing beeforehand the
exact amount of memory needed.

.



Relevant Pages

  • Re: REALLOC AND FREE
    ... If i allocate some memory using mallocand then ... Given a pointer to the first byte in a block of memory successfully ... If realloc returns a null ...
    (comp.lang.c)
  • Re: A question about deallocate() and others in Fortran
    ... Deallocate does what it says, deallocates memory and returns it to the Fortran RTL memory manager. ... If the pointer is associated with a block of allocated memory, nullify does not deallocate the memory. ... allocate will allocate a block of memory and associate it with the pointer variable. ...
    (comp.lang.fortran)
  • Re: Memeory management
    ... I did not allocate and deallocate memory ... A particular Ada compiler, with a particular set of compile options, ... Var2 at the beginning and deallocate on exit. ...
    (comp.lang.ada)
  • Tru64 issues with Infinite limits
    ... An automated test in my nightly build was failing due to Out of Memory ... Cannot allocate block 146 ...
    (comp.unix.tru64)
  • Re: supporting header-less blocks in memory allocators...
    ... then you will allocate enough memory for derived2. ... you will known the size of the object to deallocate: ...
    (comp.programming.threads)