Will this code cause a memory leak?
#include <stdexept>
class MyClass
{
public:
MyClass()
{
throw std::runtime_error("Test");
}
};
int main()
{
try
{
MyClass * myClass = new MyClass;
}
catch (const std::exception & exc)
{
// Memory leak?
}
return 0;
}
The memory allocated by new
is never deleted. Is this taken care of internally, or it an actual memory leak?