3 ms·
While I'm not saying this is a good idea, you can combine a pool allocator with longjmp exceptions to get an approximation of unwinding. It requires that you a
by rwmj 11y ago
While I'm not saying this is a good idea, you can combine a pool allocator with longjmp exceptions to get an approximation of unwinding. It requires that you are very careful about structuring your code, but I once wrote a whole web server this way: http://git.annexia.org/?p=rws.git;a=tree http://git.annexia.org/?p=rws.git;a=tree (using: http://git.annexia.org/?p=c2lib.git;a=tree http://git.annexia.org/?p=c2lib.git;a=tree ).
- halayli 11y agoBut sometimes it's not just memory. It can be files you need to close, or any other resource held.
- chaz72 11y agoThat too can be queued up, with a list of functions to call to free those resources.
- halayli 11y agoHe was referring to a memory pool allocator. But regardless, good luck with the approach.
- rwmj 11y agoPool allocators can easily deal with non-memory resources. The one I wrote in c2lib could.