As the title says, what is the difference between these 2 ways of throwing an exception?
void method1() {
//...
throw new MyException();
}
void method2() {
//...
throw "my exception";
}
I am afraid of memory leaks.
In method1 who must free the memory allocated by new?
In method2, is the string allocated on the heap (again who frees it?)? Or is it passed like a return value on the stack?