8000 Merge pull request #279 from pycom/thread_malloc · pycom/pycom-micropython-sigfox@39de84e · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 39de84e

Browse files
authored
Merge pull request #279 from pycom/thread_malloc
thread: allocate internal mem
2 parents 4cf7273 + efaea4d commit 39de84e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

esp32/mpthreadport.c

Lines changed: 3 additions & 3 deletions
9C6A
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ void mp_thread_create_ex(void *(*entry)(void*), void *arg, size_t *stack_size, i
171171
// allocate TCB, stack and linked-list node (must be outside thread_mutex lock)
172172
if (mp_chip_revision > 0) {
173173
// for revision 1 devices we allocate from the internal memory of the malloc heap
174-
tcb = malloc(sizeof(StaticTask_t));
174+
tcb = heap_caps_malloc(sizeof(StaticTask_t), MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
175175
if (!tcb) {
176176
goto memory_error;
177177
}
178-
stack = malloc(*stack_size);
178+
stack = heap_caps_malloc(*stack_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
179179
if (!stack) {
180180
goto memory_error;
181181
}
182-
th = malloc(sizeof(thread_t));
182+
th = heap_caps_malloc(sizeof(thread_t), MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
183183
if (!th) {
184184
goto memory_error;
185185
}

0 commit comments

Comments
 (0)
0