From 0303944d0cc7e033004d29e41dc149b28f4a32d0 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 1 Nov 2015 21:22:19 +0100
Subject: [PATCH] Log web browser page attributes free memory left.
After page loading has finished the number of free bytes left for page attributes is logged. It turns out that "usual" pages tend to get along with ~800 bytes while i.e. the Google search pages use all of the 2000 bytes of page attribute memory allocated by default (because of the long URLs with many parameters). So it seems that reducing this default isn't exactly the best way to reduce memory consumption...
---
apps/webbrowser/www.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c
index 346c219f6..8b13e6c13 100644
--- a/apps/webbrowser/www.c
+++ b/apps/webbrowser/www.c
@@ -34,12 +34,14 @@
#include
#include
+#include
#include "ctk/ctk.h"
#include "ctk/ctk-textentry-cmdline.h"
#include "contiki-net.h"
#include "lib/petsciiconv.h"
#include "sys/arg.h"
+#include "sys/log.h"
#if WWW_CONF_WITH_WGET
#include "program-handler.h"
#endif /* WWW_CONF_WITH_WGET */
@@ -50,13 +52,6 @@
#include "www.h"
-#if 1
-#define PRINTF(x)
-#else
-#include
-#define PRINTF(x) printf x
-#endif
-
/* The array that holds the current URL. */
static char url[WWW_CONF_MAX_URLLEN + 1];
@@ -299,6 +294,8 @@ end_page(char *status, void *focus)
petsciiconv_topetscii(webpageptr - x, x);
CTK_WIDGET_FOCUS(&mainwindow, focus);
redraw_window();
+ log_message("Page attribs free: ", itoa(pageattribs + sizeof(pageattribs) - pageattribptr,
+ pageattribs + sizeof(pageattribs) - 4, 10));
}
/*-----------------------------------------------------------------------------------*/
/* open_url():