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 21:27:37 +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 #12, patch #7088 (project lwip):

When an lwIP user defines MEM_LIBC_MALLOC, mem_malloc, mem_free, and
mem_calloc get mapped to potentially standards conformant implementations but
mem_realloc gets neutralized so clearly, I am operating outside the design
space.  If there is a danger that mem_realloc assumes the pointer won't move
for RAM pbufs somewhere else other than the DNS module, then I should revert
my mem_realloc to the neutralized function.

I agree that lwIP is consistent with itself and my change to supply a working
realloc with standards compliant semantics is the error.

The only advantage I can cite is not violating the principle of least
surprise.  Developers in the wild understand the usual semantics of the
standard memory allocation functions.  It is not difficult to think: if
mem_free can be a standards compliant free and mem_malloc can be a standards
compliant malloc and mem_calloc can be a standards compliant calloc, then
perhaps mem_realloc can be a standards compliant realloc.

I can not cite any performance or correctness advantages to this
customization only semantical consistency with the well known meanings for the
names of the memory allocation wrapper functions.

Should you decide not to integrate this patch and change the rest of the
stack to accomodate it, then may I suggest that you add a comment in mem.h
near the redefinitions of the mem_* names to make it clear that mem_realloc
cannot be made to map to a function which might move the pointed to memory?

    _______________________________________________________

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]