Missing compile-time warning for orphaned memory
Samuel David
ssprog1@gmail.com
Thu May 3 16:17:00 GMT 2012
Hi gcc team,
The following code creates orphaned memory by ignoring the return value of new:
#include<iostream>
using namespace std;
int main ( void ) {
for (int i=0; i< 10000000; i++)
new int[10000000];
int a;
cin >> a;
return 0;
}
Should g++ report a compile-time warning for this case?
root@quant:/tmp# g++ -Wall -Wextra MemoryLeakCheckCompilerWarning.cpp
-o MemoryLeakCheckCompilerWarning.exe
root@quant:/tmp#
Warm regards,
-S
More information about the Libstdc++
mailing list