mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-24 08:45:10 +03:00
Reduce String memory overhead from 24 bytes to 16 bytes by limiting the maximum string length to <64Kbytes (which is larger than heap so no effective problem). Add Small String Optimization, SSO, which instead of allocating pointers to small strings on the heap will store the string in place of the pointer in the class. This should reduce memory fragmentation as Save up to 12 chars (11 + \0) in String itself by using the terminating \0 in the inline string as a flag to identify if this is a SSO or a heap string. Add a host test that verifies that no memory is allocated until a full 11 characters are assigned to a string, as well as checking all intermediate values. No user code changes should be required to work with this optimization.