Reputation: 6080
as xmlCleanupParser()
from the very good libxml2 is not thread-safe, my question is (and I have no possibility to check it out), how much Memory (rough number) is lost to xmlParseFile()
and -more importantly- is this memory loss cumulating over many calls to xPF()
?
Upvotes: 3
Views: 2437
Reputation: 7868
Despite the fact, that malloc()
and free()
or whatever memory handling implementations are not necessarily thread safe in C < 11, there's always the problem of shared/global memory. File handles to the same file in different threads aren't that bad as long as they're read only.
However, starting with libxml2 2.4.7, you might be able to enable thread safety at the API level, for single threads per document: http://www.xmlsoft.org/threads.html
When I look at the sources of libxml2 2.9.1, I'm positive that thread safety is fully implemented, despite global mutexes, there's also an atomic allocation function.
Downloads: ftp://xmlsoft.org/libxml2/
Upvotes: 3
Reputation: 6080
following the advice given by meaning-matters, and using the only tool, I found under OS2 (this ancient old IBM operating system) to check memory, there seams to be no difference in memory-loss between using xCP() or choosing not to (for me).
Upvotes: 1