RAD Studio
ContentsIndex
PreviousUpNext
delete

Category 

Operators, C++-Specific Keywords 

Syntax  

void operator delete(void *ptr) throw();
void operator delete(void *ptr, const std::nothrow_t&) throw();
void operator delete[](void *ptr) throw();
void operator delete[](void *ptr, const std::nothrow_t &) throw();
void operator delete(void *ptr, void *) throw();   // Placement form
void operator delete[](void *ptr, void *) throw(); // Placement form

Description 

The delete operator deallocates a memory block allocated by a previous call to new. It is similar but superior to the standard library function free. 

You should use the delete operator to remove all memory that has been allocated by the new operator. Failure to free memory can result in memory leaks. 

The default placement forms of operator delete are reserved and cannot be redefined. The default placement delete operator performs no action (since no memory was allocated by the default placement new operator). If you overload the placement version of operator new, it is a good idea (though not strictly required) to provide the overload the placement delete operator with the corresponding signature.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!