Are memory leaks “undefined behavior” class problem in C++?
问题 Turns out many innocently looking things are undefined behavior in C++. For example, once a non-null pointer has been delete 'd even printing out that pointer value is undefined behavior. Now memory leaks are definitely bad. But what class situation are they - defined, undefined or what other class of behavior? 回答1: Memory leaks. There is no undefined behavior. It is perfectly legal to leak memory. Undefined behavior: is actions the standard specifically does not want to define and leaves