My code sends out UDP and TCP Packets of varying lengths depending on the situation. The packet / buffer size varies from 10 bytes to 150 bytes.
As of now I dynamically initialize a
uint8_t send_buffer or
uint8_t send_buffer and fill them up with the data that I want to send within a function.
Since I know that the max size of any buffer is 150 bytes, is it better to have a global buffer initialized right at the beginning with a fixed size of 150 bytes and use the same buffer for all situations OR have the buffers created dynamically as I need them?
uint8_t global_send_buffer; // need to send out 10 bytes udp.write(global_send_buffer, 10); // need to send out 150 udp.write(global_send_buffer, 150);