CRITICAL
Rule Definition
Not deallocating an object by using the same form for the 'delete' operator than for the 'new' operator used to allocate it leads to memory leaks.
This can also make the program terminate abnormally.
Remediation
Use 'delete' with same form of 'new' to deallocate memory.
Violation Code Sample
void f()
{
int *i = new int[10];
delete i;
}
Fixed Code Sample
void f()
{
int *i = new int[10];
delete[] i;
}
Reference
High Integrity C++ Coding Standard Manual
Related Technologies
C++
Technical Criterion
Efficiency - Memory, Network and Disk Space Management
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.