mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
trying to solve memory issue - release
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
#include "dmap_parser.h"
|
#include "dmap_parser.h"
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
|
|
||||||
#define RTSP_STACK_SIZE (9*1024)
|
#define RTSP_STACK_SIZE (8*1024)
|
||||||
#define SEARCH_STACK_SIZE (2*1048)
|
#define SEARCH_STACK_SIZE (2*1048)
|
||||||
|
|
||||||
typedef struct raop_ctx_s {
|
typedef struct raop_ctx_s {
|
||||||
|
|||||||
@@ -40,6 +40,53 @@ bool jack_inserted_svc(void);
|
|||||||
void (*spkfault_handler_svc)(bool inserted);
|
void (*spkfault_handler_svc)(bool inserted);
|
||||||
bool spkfault_svc(void);
|
bool spkfault_svc(void);
|
||||||
|
|
||||||
|
/****************************************************************************************
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void task_stats( void ) {
|
||||||
|
static struct {
|
||||||
|
TaskStatus_t *tasks;
|
||||||
|
uint32_t total, n;
|
||||||
|
} current, previous;
|
||||||
|
|
||||||
|
current.n = uxTaskGetNumberOfTasks();
|
||||||
|
current.tasks = malloc( current.n * sizeof( TaskStatus_t ) );
|
||||||
|
current.n = uxTaskGetSystemState( current.tasks, current.n, ¤t.total );
|
||||||
|
|
||||||
|
static EXT_RAM_ATTR char scratch[128+1];
|
||||||
|
*scratch = '\0';
|
||||||
|
|
||||||
|
#ifdef CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
||||||
|
uint32_t elapsed = current.total - previous.total;
|
||||||
|
|
||||||
|
for(int i = 0, n = 0; i < current.n; i++ ) {
|
||||||
|
for (int j = 0; j < previous.n; j++) {
|
||||||
|
if (current.tasks[i].xTaskNumber == previous.tasks[j].xTaskNumber) {
|
||||||
|
n += sprintf(scratch + n, "%16s %2u%% s:%5u)", current.tasks[i].pcTaskName,
|
||||||
|
100 * (current.tasks[i].ulRunTimeCounter - previous.tasks[j].ulRunTimeCounter) / elapsed,
|
||||||
|
current.tasks[i].usStackHighWaterMark);
|
||||||
|
if (i % 3 == 2 || i == current.n - 1) {
|
||||||
|
ESP_LOGI(TAG, "%s", scratch);
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
for (int i = 0, n = 0; i < current.n; i ++) {
|
||||||
|
n += sprintf(scratch + n, "%16s s:%5u\t", current.tasks[i].pcTaskName, current.tasks[i].usStackHighWaterMark);
|
||||||
|
if (i % 3 == 2 || i == current.n - 1) {
|
||||||
|
ESP_LOGI(TAG, "%s", scratch);
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (previous.tasks) free(previous.tasks);
|
||||||
|
previous = current;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -49,6 +96,8 @@ static void monitor_callback(TimerHandle_t xTimer) {
|
|||||||
heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL),
|
heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL),
|
||||||
heap_caps_get_free_size(MALLOC_CAP_SPIRAM),
|
heap_caps_get_free_size(MALLOC_CAP_SPIRAM),
|
||||||
heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM));
|
heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM));
|
||||||
|
|
||||||
|
task_stats();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
|
|||||||
@@ -728,10 +728,9 @@ static void visu_update(void) {
|
|||||||
*/
|
*/
|
||||||
void spectrum_limits(int min, int n, int pos) {
|
void spectrum_limits(int min, int n, int pos) {
|
||||||
if (n / 2) {
|
if (n / 2) {
|
||||||
int i;
|
int step = ((DISPLAY_BW - min) * visu.spectrum_scale * 2) / n;
|
||||||
float step = (DISPLAY_BW - min) * visu.spectrum_scale / (n/2);
|
|
||||||
visu.bars[pos].limit = min + step;
|
visu.bars[pos].limit = min + step;
|
||||||
for (i = 1; i < n/2; i++) visu.bars[pos+i].limit = visu.bars[pos+i-1].limit + step;
|
for (int i = 1; i < n/2; i++) visu.bars[pos+i].limit = visu.bars[pos+i-1].limit + step;
|
||||||
spectrum_limits(visu.bars[pos + n/2 - 1].limit, n/2, pos + n/2);
|
spectrum_limits(visu.bars[pos + n/2 - 1].limit, n/2, pos + n/2);
|
||||||
} else {
|
} else {
|
||||||
visu.bars[pos].limit = DISPLAY_BW;
|
visu.bars[pos].limit = DISPLAY_BW;
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
netbuf_data(inbuf, (void**)&rcvbuf, &rcvlen);
|
netbuf_data(inbuf, (void**)&rcvbuf, &rcvlen);
|
||||||
dump_net_buffer(rcvbuf, rcvlen);
|
dump_net_buffer(rcvbuf, rcvlen);
|
||||||
if (buflen + rcvlen > bufsize) {
|
if (buflen + rcvlen > bufsize) {
|
||||||
bufsize += 2048;
|
bufsize += rcvlen - bufsize < 2048 ? 2048 : rcvlen - bufsize;
|
||||||
buf = realloc(buf, bufsize);
|
buf = realloc(buf, bufsize);
|
||||||
}
|
}
|
||||||
memcpy(buf + buflen, rcvbuf, rcvlen);
|
memcpy(buf + buflen, rcvbuf, rcvlen);
|
||||||
|
|||||||
Reference in New Issue
Block a user