Florian Forster wrote: > Hi Peter, > > On Mon, Feb 08, 2010 at 07:53:52PM +0100, Peter Warasin wrote: >> print_to_socket() simply returns from current function always when it >> was not able to write to the socket. >> >> If this happens variables will not be freed. > > thank you very much for tracking down that memory leak. > > I'm not quite sure how I feel about the "garbage collector" yet. I'd fix > the memory leak by simply calling "sfree" on all variables for now and > keep the "garbage collector" as a possible new feature for the next > version. Does that sound okay to you?
sure. i did the garbage collector thing, because you can't know within print_to_socket() which variables you need to sfree(). a possibility could be to turn print_to_socket() into a function and react upon the return value, if it is -1, then sfree and return, otherwise not. well, the garbage collector is also not perfect right now. it would be better when all malloc/realloc would allocate memory to which a garbage collector points to, instead to register the variable pointers. needs however to change half of the code :) right now, i also think the realloc within add_to_array() in utils_cmd_flush changes the pointer which is registered in garbage collector.. so that probably need some more work. peter -- :: e n d i a n :: open source - open minds :: peter warasin :: http://www.endian.com :: [email protected] _______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
