samples: net: civetweb: reduce RAM usage

adjust configuration so that civetweb uses less memory
fixes #21179

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
This commit is contained in:
Alexander Kozhinov
2020-09-14 23:43:39 +02:00
committed by Jukka Rissanen
parent 06b44b12c7
commit c28ffbb2eb
2 changed files with 16 additions and 10 deletions

View File

@@ -13,12 +13,12 @@ CONFIG_NET_IPV4=y
# CONFIG_NET_IPV6 is not set
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=131072
CONFIG_NET_TX_STACK_SIZE=8192
CONFIG_NET_RX_STACK_SIZE=8192
CONFIG_ISR_STACK_SIZE=8192
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=2048
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_ISR_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_IDLE_STACK_SIZE=1024
CONFIG_DNS_RESOLVER=y

View File

@@ -10,7 +10,13 @@
#include "civetweb.h"
#define CIVETWEB_MAIN_THREAD_STACK_SIZE 4096
#define HTTP_PORT 8080
#define HTTPS_PORT 4443
#define CIVETWEB_MAIN_THREAD_STACK_SIZE CONFIG_MAIN_STACK_SIZE
/* Use samllest possible value of 1024 (see the line 18619 of civetweb.c) */
#define MAX_REQUEST_SIZE_BYTES 1024
K_THREAD_STACK_DEFINE(civetweb_stack, CIVETWEB_MAIN_THREAD_STACK_SIZE);
@@ -139,12 +145,12 @@ void *main_pthread(void *arg)
{
static const char * const options[] = {
"listening_ports",
"8080",
STRINGIFY(HTTP_PORT),
"num_threads",
"1",
"max_request_size",
"2048",
0
STRINGIFY(MAX_REQUEST_SIZE_BYTES),
NULL
};
struct mg_callbacks callbacks;