Skip to content

Commit 6b41bfb

Browse files
committed
Revert "Added mutex around malloc/free/... (not for PSRAM yet)"
This reverts commit c425a44.
1 parent c425a44 commit 6b41bfb

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

cores/rp2040/malloc-lock.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <Arduino.h>
2222
#include <malloc.h>
2323
#include <reent.h>
24-
#include "pico/mutex.h"
2524
#include "psram.h"
2625

2726
extern "C" void *__real_malloc(size_t size);
@@ -30,8 +29,6 @@ extern "C" void *__real_realloc(void *mem, size_t size);
3029
extern "C" void __real_free(void *mem);
3130
extern "C" struct mallinfo __real_mallinfo();
3231

33-
auto_init_mutex(malloc_lock_mutex);
34-
3532
#ifdef RP2350_PSRAM_CS
3633
extern "C" {
3734
extern uint8_t __psram_start__;
@@ -44,18 +41,14 @@ extern "C" {
4441

4542
extern "C" void *__wrap_malloc(size_t size) {
4643
noInterrupts();
47-
mutex_enter_blocking(&malloc_lock_mutex);
4844
void *rc = __real_malloc(size);
49-
mutex_exit(&malloc_lock_mutex);
5045
interrupts();
5146
return rc;
5247
}
5348

5449
extern "C" void *__wrap_calloc(size_t count, size_t size) {
5550
noInterrupts();
56-
mutex_enter_blocking(&malloc_lock_mutex);
5751
void *rc = __real_calloc(count, size);
58-
mutex_exit(&malloc_lock_mutex);
5952
interrupts();
6053
return rc;
6154
}
@@ -92,9 +85,7 @@ extern "C" void *__wrap_realloc(void *mem, size_t size) {
9285
rc = __real_realloc(mem, size);
9386
}
9487
#else
95-
mutex_enter_blocking(&malloc_lock_mutex);
9688
rc = __real_realloc(mem, size);
97-
mutex_exit(&malloc_lock_mutex);
9889
#endif
9990
interrupts();
10091
return rc;
@@ -109,9 +100,7 @@ extern "C" void __wrap_free(void *mem) {
109100
__real_free(mem);
110101
}
111102
#else
112-
mutex_enter_blocking(&malloc_lock_mutex);
113103
__real_free(mem);
114-
mutex_exit(&malloc_lock_mutex);
115104
#endif
116105
interrupts();
117106
}

0 commit comments

Comments
 (0)