Exception Handling of Memory

This bit of code caught my eye:


The throw is allocating a string, which is caught by its call chain. If the string is allocated on the stack, how can the call chain handle that memory after the stack is popped clean of memory? Conversely, if the allocation is in dynamic memory, where is its ‘delete’?

Fortunately, I work with someone who knows quite a bit about this topic. It turns out, I know a lot less about programming than I thought! The ensuing lecture encouraged me to dig deeper (there are a lot of references on exception implementation.) Wowsa, there is just more & more out there than meets the eye.

Exception Handling of Memory

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s