Commit f2e61db
fix: stop pulling GitHub's whole release list onto the heap (v0.6.3-beta.15)
With pre-releases enabled the update check asked for the full /releases
list and ran it through http.getString() before parsing. That answer is
109 KB today against roughly 145 KB of free heap, so the body alone took
three quarters of what was available and the document tree was built on
top of it. It failed or succeeded depending on how fragmented the heap
happened to be, which is why "JSON error" appeared once and then went
away on a retry.
Three changes, all on the same path:
- per_page=5 on the request. The list is unbounded otherwise and grows
with every release ever cut.
- The response is parsed straight off the socket instead of being
materialised as a String first.
- A filter keeps only tag_name and draft, so what lands in RAM is a
handful of bytes rather than a mirror of GitHub's answer.
The capacity DynamicJsonDocument carried was a fiction, incidentally:
ArduinoJson 7 ignores it and grows the document as needed, so the 8192
suggested a bound that was never enforced.
Also fixes a dangling pointer on the same path. tag was a const char*
into the document, the document was destroyed at the end of the block,
and tag was read afterwards. It survived because the freed block usually
still held the bytes - but since v0.6.3-beta.14 that pointer is what the
download URL is built from, so a garbage read would now produce a garbage
URL. The tag is copied into a local buffer while the document is alive.
New code uses add<JsonObject>() rather than the deprecated
createNestedObject() the older filters in this repo use. Same result, no
new deprecation warnings.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent b164c65 commit f2e61db
3 files changed
Lines changed: 52 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
77 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | | - | |
80 | 90 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
101 | 122 | | |
102 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
103 | 130 | | |
104 | 131 | | |
105 | 132 | | |
| |||
0 commit comments