Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of http-example by
Diff: source/main-https-socket-reuse.cpp
- Revision:
- 20:d851bc648f9e
- Parent:
- 17:97b1dd566b07
- Child:
- 25:a8be9f3a530c
--- a/source/main-https-socket-reuse.cpp Thu Oct 26 17:08:32 2017 -0700 +++ b/source/main-https-socket-reuse.cpp Sat Nov 18 13:58:34 2017 +0100 @@ -9,7 +9,6 @@ #include "mbed.h" #include "easy-connect.h" #include "https_request.h" -#include "mbed_stats.h" Serial pc(USBTX, USBRX); @@ -57,19 +56,11 @@ } void run() { - mbed_stats_heap_t heap_stats; - - mbed_stats_heap_get(&heap_stats); - printf("[1] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - NetworkInterface* network = easy_connect(true); if (!network) { return; } - mbed_stats_heap_get(&heap_stats); - printf("[2] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - // Create a TLS socket (which holds a TCPSocket) printf("\n----- Setting up TLS connection -----\n"); @@ -80,9 +71,6 @@ return; } - mbed_stats_heap_get(&heap_stats); - printf("[3] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - // GET request to httpbin.org { HttpsRequest* get_req = new HttpsRequest(socket, HTTP_GET, "https://httpbin.org/status/418"); @@ -96,15 +84,9 @@ printf("\n----- HTTPS GET response -----\n"); dump_response(get_res); - mbed_stats_heap_get(&heap_stats); - printf("[4a] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - delete get_req; } - mbed_stats_heap_get(&heap_stats); - printf("[4b] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - // POST request to httpbin.org { HttpsRequest* post_req = new HttpsRequest(socket, HTTP_POST, "https://httpbin.org/post"); @@ -125,14 +107,8 @@ delete post_req; } - mbed_stats_heap_get(&heap_stats); - printf("[5] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - delete socket; - mbed_stats_heap_get(&heap_stats); - printf("[6] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size); - Thread::wait(osWaitForever); }