-
Notifications
You must be signed in to change notification settings - Fork 113
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
jemallocator in cdylib ? #142
Comments
How are you using |
For the moment, I just put: #[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; in my Which is enough to switch allocators for |
And I build the python extension based on that example : https://github.com/PyO3/rust-numpy/tree/master/examples/simple-extension |
So you probably also need to get the final binary that links to your cdylib to use the same exact version of jemalloc configured in the exact same way. That might be hard to do if the binary that you are using is Hmmm, have you tried generating a |
Generating a staticlib instead of a cdylib: setuptools_rust forces I'm not sure a static lib will be easy to use as a python extension anyway.. |
Well, setuptools_rust just copies the import my_lib There's no other binary than I'll resume working on it on Monday. |
I'm not sure either. Maybe you can try asking in |
Thanks, I'll also ask on the pyo3 repo. |
jemalloc/jemalloc#937 seems related. |
It seems |
Good find! Glad it works now! |
Hello !
I'm working on a lib, and I get a 20% speed up in my tests when using jemallocator instead of the default allocator, with a marginal loss in memory usage.
But I have not found how to use it when building a lib with
crate-type = ["cdylib"]
andpyo3
.Currently, I get
cannot allocate memory in static TLS block
when importing the lib from python.Google did not help me ..
Any tips ?
Thanks a lot !
The text was updated successfully, but these errors were encountered: