Can I have some kind of a memory leak when an exception is being thrown?

Yes. The garbage collector will at some point handle that.

Allocating a huge amount of “unnecessary” memory will of course have performance considerations but that doesn’t seem to apply to this case.

1 Like