lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [patch #7088] Support for mem_realloc moving memory


From: Ken Smith
Subject: [lwip-devel] [patch #7088] Support for mem_realloc moving memory
Date: Thu, 18 Feb 2010 18:23:49 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.6) Gecko/20100107 Fedora/3.5.6-1.fc12 Firefox/3.5.6

Follow-up Comment #8, patch #7088 (project lwip):

Simon,
The patch I provided doesn't by itself guarantee the memcpy behavior you
note.  It just allows for the possibility that mem_realloc might move the
pointer.  If it never does, this patch will still work and the memcpy penalty
you mention will not incur.

The decision as to whether to incur that penalty is up to the implementer of
mem_realloc in the case of MEM_LIBC_MALLOC where the end user has supplied a
realloc function.  I realize that this is not the default behavior but it
strikes me as not an unlikely customization.

This patch itself incurs no overhead other than the extra dereferencing and
potentially changing the value of the supplied memory address.

Keiran,
The documentation in the code does assert somewhere that it expects
mem_realloc only to shrink memory and never expand it.  Perhaps this
implicitly declares that it will not move it also?

All,
I consider this patch defensive coding.  When you can enable greater safety
without incurring a great cost, doesn't it make sense to do so?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7088>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]