Skip to content

Commit b9a0e55

Browse files
committed
Added missing delete array operators
1 parent 3786ce6 commit b9a0e55

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

cores/esp8266/heap.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -769,21 +769,30 @@ uint32 IRAM_ATTR user_iram_memory_is_enabled(void)
769769
#include <cstdlib>
770770
#include <new>
771771

772-
// The sized deletes are defined in other files.
773-
#pragma GCC diagnostic ignored "-Wsized-deallocation"
774-
775772
// These function replace their weak counterparts tagged with _GLIBCXX_WEAK_DEFINITION
776-
void operator delete(void* ptr) noexcept
773+
void _heap_delete(void* ptr, const void* caller) noexcept
777774
{
778-
void* caller = __builtin_return_address(0);
779775
ISR_CHECK__LOG_NOT_SAFE(caller);
780776
_heap_vPortFree(ptr, NULL, 0, caller);
781777
}
782778

779+
void operator delete(void* ptr) noexcept
780+
{
781+
_heap_delete(ptr, __builtin_return_address(0));
782+
}
783+
784+
void operator delete[] (void *ptr) noexcept
785+
{
786+
_heap_delete(ptr, __builtin_return_address(0));
787+
}
788+
783789
void operator delete(void* ptr, std::size_t) noexcept
784790
{
785-
void* caller = __builtin_return_address(0);
786-
ISR_CHECK__LOG_NOT_SAFE(caller);
787-
_heap_vPortFree(ptr, NULL, 0, caller);
791+
_heap_delete(ptr, __builtin_return_address(0));
792+
}
793+
794+
void operator delete[] (void* ptr, std::size_t) noexcept
795+
{
796+
_heap_delete(ptr, __builtin_return_address(0));
788797
}
789798
#endif

0 commit comments

Comments
 (0)