-
Notifications
You must be signed in to change notification settings - Fork 6
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
Possible memory leak using Oxigraph as RDFlib backend #17
Comments
Thank you for trying Oxigraph! This is strange. I tried to force Python GC to run and it did not help. It's definitely possible that the leak is in the Python <-> Rust bridge, in the Rust code or in the C++ code of the storage system (RocksDB). I run LLVM memory sanitizer that integrates a leak detection mechanism as part of Oxigraph CI and it does not seems to raise any but I am not fully instrumenting the C++ codebase and I am not covering the Python <-> Rust bridge. A deeper investigation would definitely be useful. |
Thank you @Tpt for your time and the Oxigraph project! If I can help in anyway to debug this I'm available to give a helping hand... |
Thank you! If you are familiar with chasing memory leaks in C++ and Rust, it would be much appreciated. Even a minimal code like the following seems to leak a bit: import gc
import pyoxigraph
from memory_profiler import memory_usage
for i in range(100):
g = pyoxigraph.Store()
for t in g:
g.add(_to_ox(t))
del g
gc.collect()
print("Memory: ", memory_usage(-1, interval=.1, timeout=.1)[0], "MiB") Imho it's not a very high priority, the Oxigraph store is aimed at very large datasets so a bit of leak during its creation is probably not a huge issue in practice (but it's definitely worth to investigate and fix). Doing stuff like improving SPARQL evaluation is likely to help way more to keep memory usage in check. |
When RDFlib graph is used as a temporal storage it seams that the backend leaks memory, the problem doesn't apear with the default RDFlib backend.
Is there a proper way to cleanup all the memory used by the Graph?
Test code:
Result:
And with the default backend:
The text was updated successfully, but these errors were encountered: