NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Memory buffer could be stack allocated, saving global memory.

Open MHotchin opened this issue 3 years ago • 2 comments
trafficstars

MHotchin avatar Oct 01 '22 06:10 MHotchin

Currently the memory buffer used to send and receive the UDP packet is allocated in the NTP object.

It is only ever used in one function, it could be allocated as a stack object instead.

MHotchin avatar Oct 01 '22 06:10 MHotchin

My mistake - it's used in two places, but none of the data in the buffer is reused. It could be stack allocated in both functions.

MHotchin avatar Oct 01 '22 06:10 MHotchin