Skip to content

Replace "delete" with "heap_caps_free()" in destructor#906

Merged
mrcodetastic merged 1 commit into
mrcodetastic:masterfrom
blazoncek:free
Feb 5, 2026
Merged

Replace "delete" with "heap_caps_free()" in destructor#906
mrcodetastic merged 1 commit into
mrcodetastic:masterfrom
blazoncek:free

Conversation

@blazoncek

Copy link
Copy Markdown
Contributor

Replace "delete" with heap_caps_free() since data was not allocated with "new"

Replace "delete" with heap_caps_free() since data was not allocated with "new"
@mrcodetastic

Copy link
Copy Markdown
Owner

Interesting pick up. What is the practical impact? Only the pointer is deleted and the memory allocation actually remains?

@mrcodetastic mrcodetastic merged commit d015626 into mrcodetastic:master Feb 5, 2026
@blazoncek

Copy link
Copy Markdown
Contributor Author

AFAIK new and malloc (family) do not use the same memory pool.
The other issue may be with type of memory allocated (DMA/SPI) it may need special handling.

There were issues with destruction of driver on ESP32-S3, possibly related but I did not investigate in detail. "delete" (without "new") immediately jumped out.

@mrcodetastic

Copy link
Copy Markdown
Owner

Thanks for this contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants