Handshake memory cost
Is it normal to
malloc about 38K for a SSL handshake? And are there options to define packed structures for example to minimize memory usage?
In vanilla settings, yes.
You can check out ways to reduce memory usage in the knowledge base: How to reduce memory and storage footprint