r/CloudFlare•
gopro_2027

Cloudflare just saved me 47kb of memory on an embedded device

Discussion

I am a not good at networking. All I know, is that when it comes to an embedded device, I only have about 120kb of memory to work with on this chip (119,432 at boot currently to be exact). Creating a secure connection eats up enough of that, that it was causing the memory to fragment and to put it plainly, I ran out of memory. I am unfortunately not in control of the server I am connecting to, so I am unable to change this to http only. Despite there being enough total free memory, it was fragmented, and the largest block left was less than enough for a single malloc.

Previously to cloudflare, and luckily, I was able to disable some features on the device and free up enough memory to squeeze by, but it wasn't until today that I had the idea to use cloudflare as a reverse proxy to form a pure http connection, and prevent my microcontroller from having the overhead of an HTTPS connection entirely.

With a quick cloudflare worker, and a few simple changes to my code, I was able to immediately eliminate all my memory issues.

Cloudflare helped me free up a total of 47368 bytes of data, and fragmentation dropped from the largest chunk being 15kb to 65kb. Essentially going from a detrimental issue I had to worry about, to a non-issue.

Furthermore, Cloudflare also helped me discover I had an issue with some other network thing I don't really understand, I believe the response was being chunked at times? My microcontroller code had issues parsing the json occasionally. Reading the whole response in the Cloudflare worker has fixed that issue too.

I just thought this was really cool and wanted to share. Thank you cloudflare.

Posted Dec 7, 2025, 11:55 PM UTC

5420
Loading comments…