It looks like your ESP32 may have run out of free heap memory, yes.
You can check this with:
(maybe see also heap_caps_get_largest_free_block().)
If you have any large static RAM allocations that you can move to heap allocatiosn which are freed, or data which can be marked "const" so it doesn't use RAM, these will free up memory.
I found "TLS maximum message content length" in "menuconfig". It set as 16384 bytes but it's its maximum.
If you know that you're not going to ever receive a message of this length, you can reduce this down to a minimum size determined by the TLS protocols (usually around 4096 bytes). Reducing to 4KB will free 12*2KB = 24KB of mbedTLS session memory usage.
More details here: http://esp-idf.readthedocs.io/en/latest ... ontent-len