http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53215
Bug #: 53215 Summary: Warn if orphaned memory is created by ignoring return value of new Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: sspr...@gmail.com 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; } Request: g++ should report a compile-time warning message for such a memory leak. Currently, no warning is output: user@quant:/tmp$ g++ -Wall -Wextra MemoryLeakCheckCompilerWarning.cpp -o MemoryLeakCheckCompilerWarning.exe user@quant:/tmp$