Re: [xml] calling xmlCleanupParser from a library considered harmful




On 30 Oct 2012, at 02:07, Daniel Veillard wrote:

Opinions about this ?

One issue is that for library authors there is no safe way of making your library not introduce reported 
valgrind leakage into the calling program.

Could you add 1 to a counter on xmlInit() and decrement it on xmlCleanupParser(), and only do anything if 
xmlCleanupParser hits zero.

I think this is safe in that all you'd do is memory leak if the app or the library didn't pair their 
statements. You could have a xmlImNotALibrarySoForceCleanupParser() or similar for the main program.

-- 
Alex Bligh







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]