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-http.cpp
- Revision:
- 20:d851bc648f9e
- Parent:
- 17:97b1dd566b07
- Child:
- 28:9bccd981a393
--- a/source/main-http.cpp Thu Oct 26 17:08:32 2017 -0700
+++ b/source/main-http.cpp Sat Nov 18 13:58:34 2017 +0100
@@ -5,7 +5,6 @@
#include "mbed.h"
#include "easy-connect.h"
#include "http_request.h"
-#include "mbed_stats.h"
Serial pc(USBTX, USBRX);
@@ -22,11 +21,6 @@
int main() {
pc.baud(115200);
- 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);
-
// Connect to the network (see mbed_app.json for the connectivity method used)
NetworkInterface* network = easy_connect(true);
if (!network) {
@@ -34,9 +28,6 @@
return 1;
}
- 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);
-
// Do a GET request to httpbin.org
{
// By default the body is automatically parsed and stored in a buffer, this is memory heavy.
@@ -55,9 +46,6 @@
delete get_req;
}
- 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);
-
// POST request to httpbin.org
{
HttpRequest* post_req = new HttpRequest(network, HTTP_POST, "http://httpbin.org/post");
@@ -74,15 +62,9 @@
printf("\n----- HTTP POST response -----\n");
dump_response(post_res);
- mbed_stats_heap_get(&heap_stats);
- printf("[4] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
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);
-
Thread::wait(osWaitForever);
}
