@@ -19,7 +19,7 @@ Results
1919
2020## On AVR
2121
22- Here is the serial output of this program with the Arduino Core for AVR version 1.6.22:
22+ Here is output with the Arduino Core for AVR version 1.6.22:
2323
2424```
2525#1: Initialize from RAM
@@ -101,7 +101,7 @@ Here is the serial output of this program with the Arduino Core for AVR version
101101- free(0x23c)
102102
103103#11: Pass a null string to the constructor
104- - malloc(65 ) -> 0x23c
104+ - malloc(64 ) -> 0x23c
105105- strcpy(0x23c, 0x155) - 5 bytes
106106- strcpy(0x241, 0x15b) - 12 bytes
107107- strcpy(0x24d, 0x168) - 5 bytes
@@ -116,7 +116,7 @@ Here is the serial output of this program with the Arduino Core for AVR version
116116
117117## On ESP8266
118118
119- Here is the serial output of this program with the Arduino Core for ESP8266 version 2.4.2:
119+ Here is the output with the Arduino Core for ESP8266 version 2.4.2:
120120
121121```
122122#1: Initialize from RAM
@@ -209,4 +209,103 @@ Here is the serial output of this program with the Arduino Core for ESP8266 vers
209209- malloc(33) -> 0x3ffef3fc
210210- strcpy(0x3ffef3fc, 0x3ffe88c8) - 32 bytes
211211- free(0x3ffef3fc)
212- ```
212+ ```
213+
214+ ## On SAMD
215+
216+ Here is the output with the Arduino Core for SAMD version 1.6.19:
217+
218+ ```
219+ #1: Initialize from RAM
220+ - malloc(8) -> 0x20000a80
221+ - strcpy(0x20000a80, 0x8638) - 7 bytes
222+ - free(0x20000a80)
223+
224+ #2: Initialize from Flash
225+ - malloc(8) -> 0x20000a80
226+ - strcpy(0x20000a80, 0x8638) - 7 bytes
227+ - free(0x20000a80)
228+
229+ #3: toCharArray()
230+ - malloc(8) -> 0x20000a80
231+ - strcpy(0x20000a80, 0x8638) - 7 bytes
232+ - strncpy(0x20007fb8, 0x20000a80, 7) - 7 bytes
233+ - free(0x20000a80)
234+
235+ #4: c_str()
236+ - malloc(8) -> 0x20000a80
237+ - strcpy(0x20000a80, 0x8638) - 7 bytes
238+ - free(0x20000a80)
239+
240+ #5: Pass by value
241+ - malloc(8) -> 0x20000a80
242+ - strcpy(0x20000a80, 0x8638) - 7 bytes
243+ - malloc(8) -> 0x20000a90
244+ - strcpy(0x20000a90, 0x20000a80) - 7 bytes
245+ - free(0x20000a90)
246+ - free(0x20000a80)
247+
248+ #6: Pass by const reference
249+ - malloc(8) -> 0x20000a90
250+ - strcpy(0x20000a90, 0x8638) - 7 bytes
251+ - free(0x20000a90)
252+
253+ #7: Move instance
254+ - malloc(8) -> 0x20000a90
255+ - strcpy(0x20000a90, 0x8638) - 7 bytes
256+ - free(0x20000a90)
257+ - free(0)
258+
259+ #8: Append temporaries
260+ - malloc(6) -> 0x20000a90
261+ - strcpy(0x20000a90, 0x86cf) - 5 bytes
262+ - malloc(6) -> 0x20000a80
263+ - strcpy(0x20000a80, 0x20000a90) - 5 bytes
264+ - realloc(0x20000a80, 18) -> 0x20000aa0
265+ - strcpy(0x20000aa5, 0x86d5) - 12 bytes
266+ - realloc(0x20000aa0, 23) -> 0x20000ab8
267+ - strcpy(0x20000ac9, 0x86e2) - 5 bytes
268+ - realloc(0x20000ab8, 33) -> 0x20000ad8
269+ - strcpy(0x20000aee, 0x876b) - 10 bytes
270+ - malloc(33) -> 0x20000ab0
271+ - strcpy(0x20000ab0, 0x20000ad8) - 32 bytes
272+ - free(0x20000ad8)
273+ - free(0x20000a90)
274+ - free(0x20000ab0)
275+
276+ #9: Mutate instance
277+ - malloc(6) -> 0x20000af8
278+ - strcpy(0x20000af8, 0x86cf) - 5 bytes
279+ - realloc(0x20000af8, 18) -> 0x20000ad8
280+ - strcpy(0x20000add, 0x86d5) - 12 bytes
281+ - realloc(0x20000ad8, 23) -> 0x20000ad8
282+ - strcpy(0x20000ae9, 0x86e2) - 5 bytes
283+ - realloc(0x20000ad8, 33) -> 0x20000ab0
284+ - strcpy(0x20000ac6, 0x876b) - 10 bytes
285+ - free(0x20000ab0)
286+
287+ #10: Call reserve
288+ - malloc(1) -> 0x20000af8
289+ - strcpy(0x20000af8, 0x8b76) - 0 bytes
290+ - realloc(0x20000af8, 65) -> 0x20000ab0
291+ - strcpy(0x20000ab0, 0x86cf) - 5 bytes
292+ - strcpy(0x20000ab5, 0x86d5) - 12 bytes
293+ - strcpy(0x20000ac1, 0x86e2) - 5 bytes
294+ - strcpy(0x20000ac6, 0x876b) - 10 bytes
295+ - free(0x20000ab0)
296+
297+ #11: Pass a null string to the constructor
298+ - malloc(64) -> 0x20000ab8
299+ - strcpy(0x20000ab8, 0x86cf) - 5 bytes
300+ - strcpy(0x20000abd, 0x86d5) - 12 bytes
301+ - strcpy(0x20000ac9, 0x86e2) - 5 bytes
302+ - strcpy(0x20000ace, 0x876b) - 10 bytes
303+ - free(0x20000ab8)
304+
305+ #12: Concat at compile time
306+ - malloc(33) -> 0x20000ad8
307+ - strcpy(0x20000ad8, 0x8755) - 32 bytes
308+ - free(0x20000ad8)
309+ ```
310+
311+ In #2 we can see that this board doesn't support Flash strings.
0 commit comments