use same heap_caps_malloc parameter as ps_malloc. (#4484)

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Fabian 2023-02-26 19:42:29 +01:00 committed by GitHub
parent 6ec18fc630
commit 1a9141877d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -612,7 +612,7 @@ template<class T> class ExternalRAMAllocator {
size_t size = n * sizeof(T); size_t size = n * sizeof(T);
T *ptr = nullptr; T *ptr = nullptr;
#ifdef USE_ESP32 #ifdef USE_ESP32
ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)); ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
#endif #endif
if (ptr == nullptr && (this->flags_ & Flags::REFUSE_INTERNAL) == 0) if (ptr == nullptr && (this->flags_ & Flags::REFUSE_INTERNAL) == 0)
ptr = static_cast<T *>(malloc(size)); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc) ptr = static_cast<T *>(malloc(size)); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc)