As discussed on the developers mailing list:
http://arduino.cc/pipermail/developers_arduino.cc/2012-March/006358.html
Changes to the Ethernet DHCP library between 1.0 and 1.0.1rc1 have resulted in
the code being larger and consuming more RAM.
<sketch> = <compiled size>, <free ram>
IDE 1.0:
No ethernet = 6826, 1236
Static IP = 8598, 1142
DHCP IP = 15040, 1090
IDE 1.0.1rc1:
No ethernet = 6714, 1236
Static IP = 8536, 1140
DHCP IP = 16470, 982
Those numbers further deteriorate if the new "maintain()" method is used.
Once specific concern is the use of "new" to create an instance of the
DHCPClass. I'd like to suggest the following change to Ethernet.cpp:
int EthernetClass::begin(uint8_t *mac_address)
{
- _dhcp = new DhcpClass();
+ static DhcpClass dhcp;
+ _dhcp = &dhcp;
This change saves almost 500 bytes of code. It has no impact on RAM use.
I've given the change some superficial testing and it seems to work.
Thanks,
Dylan
Original issue reported on code.google.com by dy...@deedums.com on 19 Mar 2012 at 9:27
Original issue reported on code.google.com by
dy...@deedums.com
on 19 Mar 2012 at 9:27