From: Phil R. <p.d...@gm...> - 2016-02-29 13:04:18
|
> > @Phil: I assume with a lot of trouble (such as implementing more > centralized control of our memory allocations) you could deal with > resource leaks using the setjmp/longjmp approach, but for the above > reason I don't think you should bother. actually not that much trouble. We just have plmalloc keep a list of all memory allocations in a variable in the PLStream and plfree can remove items from that list. Then we have a free all function which gets called before the API returns, which frees anything left on the list. This not only deals with memory leaks after a longjmp, but if we miss a free anywhere it will also clean up any other memory leaks. I have already implemented it in the plmalloc/plfree functions I've written. I'm just adding the calls and I will forward it round. Phil |