Strange size of simple method in Project Inspect

When I run Project inspect on my project, which includes the TinyGsm library.
When I sort the inspect symbol results on size, it shows a method from the TinyGSM library as the largest symbol, 4.1 K.

How is this possible?

The method contains no more than this:
virtual void stop(uint32_t maxWaitMs) {
at->sendAT(GF(“+CIPCLOSE=”), mux, GF(“,1”)); // Quick close
sock_connected = false;

The first line in this method is apparently a macro. What does it expand into?

The macro contains this:

rx.clear(); \
at->maintain(); \
unsigned long startMillis = millis(); \
while (sock_available > 0 && (millis() - startMillis < maxWaitMs)) { \
  at->modemRead(TinyGsmMin((uint16_t), sock_available), mux); \
  rx.clear(); \
  at->maintain(); \


#define TINY_GSM_YIELD() { delay(TINY_GSM_YIELD_MS); }

And TinyGsmMin is defined as:

template<class T>
const T& TinyGsmMin(const T& a, const T& b)
    return (b < a) ? b : a;

and modemSend():

int16_t modemSend(const void* buff, size_t len, uint8_t mux) {
sendAT(GF("+QISEND="), mux, ',', (uint16_t)len);
if (waitResponse(GF(">")) != 1) {
  return 0;
stream.write((uint8_t*)buff, len);
if (waitResponse(GF(GSM_NL "SEND OK")) != 1) {
  return 0;
// TODO: Wait for ACK? AT+QISEND=id,0
return len;


I can’t name the exact cause for sure, but there are a number of optimizations the compiler can use to increase code execution speed at the expense of code size. I don’t know if it’s possible to look into the generated assembly to verify this. @ivankravets?