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: Simon Goldschmidt
Subject: [lwip-devel] [patch #7088] Support for mem_realloc moving memory
Date: Thu, 18 Feb 2010 06:34:23 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6

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

Sorry for not being too clear. Let me first how I see this:
- we agreed that for incoming packets, it wouldn't change anything
- mem_realloc is used from pbuf_realloc only
- pbuf_realloc is currently used only for packets that are about to be sent
-> if we save memory, then only for a short time, and often far less than the
MTU

Now at the time pbuf_realloc is called, the pbuf is already filled with the
data to be sent but is too long. Instead of merely adjusting it len (and
tot_len), we call pbuf_realloc to give the unused memory back to the heap.

If mem_realloc actually moves the pbuf in memory, it will have to move the
contained data, too. And this will be done using something like memcpy.

This is why I said we trade memory-saving for memcpy: We *have* to copy data
if the new (smaller) region resides at another place in memory than the old
region.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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