aboutsummaryrefslogtreecommitdiff
path: root/programs/ssl/ssl_server2.c
diff options
context:
space:
mode:
Diffstat (limited to 'programs/ssl/ssl_server2.c')
-rw-r--r--programs/ssl/ssl_server2.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index d23a700..13031d5 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -1838,7 +1838,10 @@ int main( int argc, char *argv[] )
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
-#endif
+#if defined(MBEDTLS_MEMORY_DEBUG)
+ size_t current_heap_memory, peak_heap_memory, heap_blocks;
+#endif /* MBEDTLS_MEMORY_DEBUG */
+#endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */
/*
* Make sure memory references are valid in case we exit early.
@@ -3742,6 +3745,13 @@ handshake:
}
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
+#if defined(MBEDTLS_MEMORY_DEBUG)
+ mbedtls_memory_buffer_alloc_cur_get( &current_heap_memory, &heap_blocks );
+ mbedtls_memory_buffer_alloc_max_get( &peak_heap_memory, &heap_blocks );
+ mbedtls_printf( "Heap memory usage after handshake: %lu bytes. Peak memory usage was %lu\n",
+ (unsigned long) current_heap_memory, (unsigned long) peak_heap_memory );
+#endif /* MBEDTLS_MEMORY_DEBUG */
+
if( opt.exchanges == 0 )
goto close_notify;