-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak while unlink! multithreaded !? #204
Comments
Yes, this package is not threadsafe. |
Completely ? Because libxml2 has thread support as long as the different threads operate on different documents. Concerning the second condition in the above link: Or is the julia code in this package not thread safe? |
Yes, this package can be made threadsafe, but doing so will require significant work. To start, IIUC, the build script needs to be updated to "configure the library accordingly using the --with-threads options" Another option is to use multiprocessing instead of multithreading with a library like https://github.com/JuliaPluto/Malt.jl You can also try https://github.com/JuliaComputing/XML.jl I don't have the bandwidth to work on this right now, but any PR's to document good workarounds or fix multithreading issues are greatly appreciated. |
Apparently So the only action needed may be calling xmlInitParser() in I'm going to try that although having no experience in using C from Julia. Thanks for the pointer to Malt! |
Hi there,
I think there's a problem using unlink! in a multihreaded context. The real case is reading and modifying relatively big xml files (hundreds of megs) and after a while I am running out of memory and the process crashes. But one can a catch glimpse on the problem (not sure although) by adding this test:
It seems to loose memory (~20GB) in the first loop, but does not consume more memory in the second loop.
Without
Threads.@threads
it's different:If I finalize the unlinked node after unlinking, free memory stays almost stable in both cases (although it's very slow of course).
Does
unlink!
require certain follow-up actions?Please help :-)
Para
The text was updated successfully, but these errors were encountered: