Skip to content

Fix memory consumption/fragmentation issues and - #58

Open
jamesinc wants to merge 1 commit into
MatixYo:mainfrom
jamesinc:memory
Open

Fix memory consumption/fragmentation issues and#58
jamesinc wants to merge 1 commit into
MatixYo:mainfrom
jamesinc:memory

Conversation

@jamesinc

Copy link
Copy Markdown

I had a lot of trouble with JSON payload parsing randomly losing bytes, and after the esp32 has been running for some time, was also seeing errors relating to memory allocation for the SSL socket.

After some digging I have made a few changes. Most controversially, the config portal will now despawn after 5 minutes without a setting being changed. I figure I don't really need it much but can always reboot to launch it.

The adsb_client.cpp changes are all for memory optimisation. The client objects are now reused, and PollingStream replaces payload.concat() so data is now streamed in directly, avoiding an intermediate string buffer, which is what was causing the random missing API response bytes. PollingStream uses a chunked buffer so that pollNetwork() can be called at an appropriate rate.

I also asked Claude for its opinions on the ADSB client and it suggested adding a deserialisation filter that eliminates all the extraneous keys from the JSON payloads, that seems to work well so I've included it also.

Finally, I tweaked the font sizes for when font smoothing is disabled as some of them were huge.

If there is interest in merging any of this work but you want to de-scope any of it let me know and I will amend the PR accordingly.

timclarke07 added a commit to timclarke07/ESP32-Plane-Radar that referenced this pull request Aug 12, 2026
Adapted from upstream PR MatixYo#58 (memory). Reusing WiFiClientSecure/HTTPClient
across fetches avoids heap fragmentation from allocating and freeing a new
TLS context every ~3 s, which otherwise surfaces as SSL memory errors after
long uptime. Bitmap (non-smooth) cardinals/tags fall back to 9pt. Default
preset is now 15 km.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant