mirror of https://github.com/ARMmbed/mbed-os.git
MPS2 CM3DS ethernet fix heap bug
The function SMSC9220_EMAC::low_level_input should create a heap for the packet equal to the size of the message (most of which are couple hundred bytes). The current code uses maximum frame size (1522 bytes) for each packet. This will cause the heap to quickly fill up. In fact, the default memory size (lwip.mem-size) used for this heap is 1600 bytes. This means that once you have one other packet allocated (extremely common), the heap allocation will always fails. Also, it is recommend to increase the default lwip.mem-size because that amount is very small especially if you send or receive a few large packets in the network. This is NOT done in current commit.pull/15284/head
parent
14aa25b8b7
commit
cbfda0e23b
|
@ -89,7 +89,7 @@ emac_mem_buf_t *SMSC9220_EMAC::low_level_input()
|
|||
message_length -= CRC_LENGTH_BYTES;
|
||||
}
|
||||
|
||||
p = _memory_manager->alloc_heap(SMSC9220_ETH_MAX_FRAME_SIZE,
|
||||
p = _memory_manager->alloc_heap(message_length,
|
||||
SMSC9220_BUFF_ALIGNMENT);
|
||||
|
||||
if (p != NULL) {
|
||||
|
|
Loading…
Reference in New Issue