Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message
Spock said...

Automatically freeing allocated memory is pretty cool. It doesn't really solve the problem, though.

That's just something that's built in and ready to use right now.

Spock said...

If an allocation originates outside the routine (eg, in my fast string allocator or my dib32 library or font library etc.. which are used a lot in my programs) there is now direct exposure to memory leaks should an exception occur when the prgram is using them.

What about external accesses to, eg, Windows routines? Many of these follow the pattern:

Get resource (memory, handle, DC, etc..)
Do something with it
Return resource

You can create any sort of cleanup routine you can imagine and attach that to the resource. Memory is just a simple and obvious thing, so the library does it for you if you ask.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu