program to test a possible memory leak when using NTP

Dependencies:   NetServices mbed

Files at this revision

API Documentation at this revision

Comitter:
hlipka
Date:
Tue Jan 25 20:32:58 2011 +0000
Parent:
0:3986c9f76b09
Child:
2:006625ab89d2
Commit message:
test with new mbed library

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Dec 22 10:10:39 2010 +0000
+++ b/main.cpp	Tue Jan 25 20:32:58 2011 +0000
@@ -1,63 +1,55 @@
-#include "mbed.h"
-
-#include "EthernetNetIf.h"
-#include "NTPClient.h"
-
-#include "AvailableMemory.h"
-
-LocalFileSystem local("local");
-
-void updateTime()
-{
-    time_t ctTime;
-    time(&ctTime);
-    printf("Current time is (UTC): %s\n", ctime(&ctTime));
-
-    NTPClient ntp;
-    Host server(IpAddr(), 123, "0.de.pool.ntp.org");
-    ntp.setTime(server);
-
-    printf("set time ok\n");
-    time(&ctTime);
-    printf("Current time is (UTC): %s\n", ctime(&ctTime));
-   
-}
-
-int main() {
-    printf("calculate free mem 1\n");
-    int i=AvailableMemory(1,0x8000,false);
-    printf("free mem=%i\n",i);
-
-//    void* p1=malloc(8000);
-//    void* p2=malloc(8000);
-
-    printf("calculate free mem 2\n");
-    i=AvailableMemory(1,0x8000,false);
-    printf("free mem=%i\n",i);
-
-    printf("setup\n");
-    EthernetNetIf eth;
-    EthernetErr ethErr;
-    printf("Setting up...\n");
-    do {
-        ethErr = eth.setup();
-        if (ethErr) printf("waiting for network...\n", ethErr);
-    } while (ethErr != ETH_OK);
-
-    printf("setup ok\n");
-
-    printf("calculate free mem 3\n");
-    i=AvailableMemory(1,0x8000,false);
-    printf("free mem=%i\n",i);
-    printf("calculate free mem 3\n");
-    i=AvailableMemory(1,0x8000,false);
-    printf("free mem=%i\n",i);
-
-    updateTime();
-
-//    free(p1);
-//    free(p2);
-    printf("calculate free mem 4\n");
-    i=AvailableMemory(1,0x100,false);
-    printf("free mem=%i\n",i);
-}
+#include "mbed.h"
+
+#include "EthernetNetIf.h"
+#include "NTPClient.h"
+
+#include "AvailableMemory.h"
+
+LocalFileSystem local("local");
+
+void updateTime()
+{
+    time_t ctTime;
+    time(&ctTime);
+    printf("Current time is (UTC): %s\n", ctime(&ctTime));
+
+    NTPClient ntp;
+    Host server(IpAddr(), 123, "de.pool.ntp.org");
+    ntp.setTime(server);
+    
+    printf("set time ok\n");
+    time(&ctTime);
+    printf("Current time is (UTC): %s\n", ctime(&ctTime));
+   
+}
+
+int main() {
+    printf("******** [%s] *********\n",__TIME__);
+    printf("calculate free mem 1\n");
+    int i=AvailableMemory(1,0x8000,false);
+    printf("free mem=%i\n",i);
+
+//    void* p1=malloc(8000);
+//    void* p2=malloc(8000);
+
+    printf("setup\n");
+    EthernetNetIf eth;
+    EthernetErr ethErr;
+    printf("Setting up...\n");
+    do {
+        ethErr = eth.setup();
+        if (ethErr) printf("waiting for network...\n", ethErr);
+    } while (ethErr != ETH_OK);
+
+    printf("setup ok\n");
+
+    updateTime();
+
+//    free(p1);
+//    free(p2);
+    printf("calculate free mem 4\n");
+    i=AvailableMemory(1,0x100,false);
+    printf("free mem=%i\n",i);
+    i=AvailableMemory(1,0x8000,false);
+    printf("free mem=%i\n",i);
+}
--- a/mbed.bld	Wed Dec 22 10:10:39 2010 +0000
+++ b/mbed.bld	Tue Jan 25 20:32:58 2011 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1