8000 fix: fix memory leak in promise impl · marcelkottmann/esp32-javascript@0c2f5e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c2f5e1

Browse files
fix: fix memory leak in promise impl
1 parent 07f2aeb commit 0c2f5e1

File tree

6 files changed

+549
-513
lines changed

6 files changed

+549
-513
lines changed

components/esp32-javascript/esp32-javascript.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ static duk_ret_t el_ledcWrite(duk_context *ctx)
532532

533533
static duk_ret_t info(duk_context *ctx)
534534
{
535-
size_t internal = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
536-
size_t external = heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
535+
size_t internal = heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
536+
size_t external = heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
537537

538538
jslog(INFO, "INTERNAL MEMORY HEAP INFO FREE: %d", internal);
539539
jslog(INFO, "EXTERNAL MEMORY HEAP INFO FREE: %d", external);
@@ -631,7 +631,7 @@ IRAM_ATTR void *duk_spiram_malloc(void *udata, size_t size)
631631
{
632632
if (spiramAvailable)
633633
{
634-
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM);
634+
return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
635635
}
636636
else
637637
{
@@ -647,7 +647,7 @@ IRAM_ATTR void *duk_spiram_realloc(void *udata, void *ptr, size_t size)
647647
{
648648
if (spiramAvailable)
649649
{
650-
return heap_caps_realloc(ptr, size, MALLOC_CAP_SPIRAM);
650+
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
651651
}
652652
else
653653
{
@@ -677,7 +677,7 @@ IRAM_ATTR void spiram_free(void *ptr)
677677

678678
bool spiramAvail()
679679
{
680-
void *ptr = heap_caps_malloc(1, MALLOC_CAP_SPIRAM);
680+
void *ptr = heap_caps_malloc(1, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
681681
if (ptr != NULL)
682682
{
683683
heap_caps_free(ptr);

0 commit comments

Comments
 (0)
0