What change would like to see?
I would like to see dynamic memory allocation removed from the Wire library.
Why?
The length of the dynamically-allocated buffers never changes, so I can't see
any reason to use dynamic allocation. It's probably not a big deal for most
people, but I've recently been struggling with random crashes due to SRAM
issues (e.g. see http://www.arduino.cc/playground/Code/AvailableMemory); I'm
not an expert, but my take is that it's better to avoid dynamic memory
allocation unless it's absolutely necessary. I can't see any advantages in
this case, and static allocation simplifies memory profiling...
Would this cause any incompatibilities with previous versions? If so, how
can these be mitigated?
No.
I've modified Wire.h/cpp and twi.c by statically allocating all buffers. The
attached patch was made against r959.
Original issue reported on code.google.com by ryanfobel on 14 Sep 2010 at 5:17
Original issue reported on code.google.com by
ryanfobel
on 14 Sep 2010 at 5:17Attachments: