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.

Deleting array elements in JavaScript - delete vs splice

What is the difference between using the delete operator on the array element as opposed to using the Array.splice …

javascript arrays element delete-operator array-splice
Deleting a pointer in C++

Context: I'm trying to wrap my head around pointers, we just saw them a couple of weeks ago in school …

c++ pointers delete-operator
Does delete on a pointer to a subclass call the base class destructor?

I have an class A which uses a heap memory allocation for one of its fields. Class A is instantiated …

c++ memory-management destructor delete-operator base-class
C++ delete vector, objects, free memory

I am totally confused with regards to deleting things in C++. If I declare an array of objects and if …

c++ vector delete-operator
Is it safe to delete a NULL pointer?

Is it safe to delete a NULL pointer? And is it a good coding style?

c++ pointers memory-management null-pointer delete-operator
How does delete[] know it's an array?

Alright, I think we all agree that what happens with the following code is undefined, depending on what is passed, …

c++ arrays pointers new-operator delete-operator
Meaning of = delete after function declaration

class my_class { ... my_class(my_class const &) = delete; ... }; What does = delete mean in that context? Are there any …

c++ function c++11 declaration delete-operator
C++ Array of pointers: delete or delete []?

Cosider the following code: class Foo { Monster* monsters[6]; Foo() { for (int i = 0; i < 6; i++) { monsters[i] = new Monster(); } } virtual ~…

c++ arrays pointers delete-operator
Is delete this allowed?

Is it allowed to delete this; if the delete-statement is the last statement that will be executed on that instance …

c++ memory-management new-operator delete-operator self-destruction
Double free or corruption after queue::push

#include <queue> using namespace std; class Test{ int *myArray; public: Test(){ myArray = new int[10]; } ~Test(){ delete[] myArray; } }; int …

c++ runtime-error delete-operator