[Top][All Lists]
[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/
- [lwip-devel] [patch #7088] DNS with custom malloc/realloc contains a double free in RAM pbuf realloc, Ken Smith, 2010/02/09
- [lwip-devel] [patch #7088] DNS with custom malloc/realloc contains a double free in RAM pbuf realloc, Kieran Mansley, 2010/02/11
- [lwip-devel] [patch #7088] DNS with custom malloc/realloc contains a double free in RAM pbuf realloc, Simon Goldschmidt, 2010/02/11
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Simon Goldschmidt, 2010/02/12
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Simon Goldschmidt, 2010/02/17
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Ken Smith, 2010/02/17
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Simon Goldschmidt, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Kieran Mansley, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory,
Ken Smith <=
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Kieran Mansley, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Ken Smith, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Kieran Mansley, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Ken Smith, 2010/02/18
- [lwip-devel] [patch #7088] Support for mem_realloc moving memory, Simon Goldschmidt, 2010/02/19