>Btw, you can kill me if you want, but this is the official Dan solution >for solving memory leaks most of the time. Everything I code thats my >own project I have a special style for handling these.
>>1) create a goto section at the bottom of the function for exception >handling >2) As I allocate memory put free() for that in the goto section as I go >along. >3) make a local definition of an integer call funcError then assign >defined error codes.
>4) All fail or pass handling be handled in the goto
However, a better solution might be obstack, which is provided by libiberty. Its the only thing I have found that implements a method similar to NSAutoreleasePool. I know I am going against Timo on this one. I would hate to use glib for this overall, since I just personally don't like glib. My impression of glib is written by a person couldn't remember typecasts and wanted to reimplement C++ in C, C++ style. It has been very successful of imitating C++ in many ways including some of the problems in C++. If it resorted to that, I'd prefer to use C++. But as I was saying before, obstack is precisely what is needed. It provides reference counting and a fairly sane way to handle stacks.
Dan
signature.asc
Description: OpenPGP digital signature