mirror of
https://github.com/esphome/esphome.git
synced 2025-10-10 05:43:48 +01:00
Always abort on allocation when out-of-memory (#2129)
Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
@@ -275,8 +275,8 @@ void Nextion::upload_tft() {
|
||||
} else {
|
||||
#endif
|
||||
ESP_LOGD(TAG, "Allocating buffer size %d, Heap size is %u", chunk_size, ESP.getFreeHeap());
|
||||
this->transfer_buffer_ = new uint8_t[chunk_size];
|
||||
if (!this->transfer_buffer_) { // Try a smaller size
|
||||
this->transfer_buffer_ = new (std::nothrow) uint8_t[chunk_size];
|
||||
if (this->transfer_buffer_ == nullptr) { // Try a smaller size
|
||||
ESP_LOGD(TAG, "Could not allocate buffer size: %d trying 4096 instead", chunk_size);
|
||||
chunk_size = 4096;
|
||||
ESP_LOGD(TAG, "Allocating %d buffer", chunk_size);
|
||||
|
Reference in New Issue
Block a user