Possible Duplicate:
Are memory leaks “undefined behavior” class problem in C++?
Never calling delete
or delete[]
on address returned by new
or new []
resp in a C++ program is an Undefined Behavior or merely a memory leak?
References from the Standard(if any) are welcome.
This came up in one of the comments here & I am just a bit confused about it.
Referring to [basic.stc.dynamic.deallocation] (aka 3.7.4.2 in n3337) there are only 4 paragraphs.
operator delete
andoperator delete[]
should be either class members or in global scopeoperator delete
andoperator delete[]
delete
can be used for deallocation, depending on whichnew
was used for allocationThere is absolutely no note here on what would happen if storage is allocated but never released.
I don't think that the Standard concerns itself with this, so it is more unspecified rather than undefined.