Top "Delete-operator" questions

In the C++ programming language, the delete operator calls the destructor of the given argument, and returns memory allocated by new back to the heap.

Delete on already deleted object : behavior?

I am wondering what will hapen if I try to do a delete on a pointer that is already deleted, …

c++ pointers memory-management delete-operator
Is delete[] equal to delete?

IP_ADAPTER_INFO *ptr=new IP_ADAPTER_INFO[100]; if I free using delete ptr; will it lead to memory leak, …

c++ memory-management delete-operator
Deleting vector of pointers

I need to create pointers of instances of a class, and the program do not know at compilation time how …

c++ pointers vector smart-pointers delete-operator
Why there is no placement delete expression in C++?

Why C++ hasn't placement delete that directly corresponds to the placement new, i.e. calls the destructor and calls appropriate …

c++ c++11 new-operator delete-operator
What happens when you deallocate a pointer twice or more in C++?

int main() { Employee *e = new Employee(); delete e; delete e; ... delete e; return 0; }

c++ pointers memory-management allocation delete-operator
Delete large data with same partition key from DynamoDB

I have DynamoDB table structured like this A B C D 1 id1 foo hi 1 id2 var hello A is the …

amazon-dynamodb delete-operator
Deleting multiple pointers with single delete operator

For deleting and an array of element we use delete[]. Is it possible to delete the pointers the way I …

c++ pointers delete-operator
"delete this" in constructor

What actually happen when I execute this code? class MyClass { MyClass() { //do something delete this; } }

c++ constructor destructor delete-operator self-destruction
Why, really, deleting an incomplete type is undefined behaviour?

Consider this classic example used to explain what not to do with forward declarations: //in Handle.h file class Body; …

c++ memory-management destructor forward-declaration delete-operator
How does =delete on destructor prevent stack allocation?

In this SO question is stated that this construct prevents stack allocation of instance. class FS_Only { ~FS_Only() = delete; // …

c++ c++11 delete-operator