Closed njlr closed 6 years ago
I am using version 0d78599a57aa7499b5f8f398ddf7860d7434dafd
.
As a work-around I can force jemalloc
with -DUSE_JEMALLOC=1
, however it would be nice to use one zcalloc
everywhere.
I'm having the same problem at the moment. Looking through the source I'm struggling to understand why zmalloc
is used here. It appears to be from the Redis source and adds functionality to track the total amount of memory allocated, however r3
doesn't appear to access the functionality in any way (it just uses it as a malloc
wrapper).
Initially, i choosed jemalloc as the memory allocator.
However a Japanese guy thought zmalloc is faster than all the memory allocator. A PR was merged.
As the time goes by, I started thinking that we should keep the design and the implementation simple.
So it’s very open. Proposals are welcomed.
Mike Steinert notifications@github.com於 2018年7月1日 週日,02:15寫道:
I'm having the same problem at the moment. Looking through the source I'm struggling to understand why zmalloc is used here. It appears to be from the Redis source and adds functionality to track the total amount of memory allocated, however r3 doesn't appear to access the functionality in any way (it just uses it as a malloc wrapper).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/c9s/r3/issues/104#issuecomment-401557554, or mute the thread https://github.com/notifications/unsubscribe-auth/AADGziREyG8_iyCI2DUyiGx_UpBwk5JTks5uB8A0gaJpZM4Pr5xF .
Thanks for the background information. I suspect that zmalloc
is actually slower since it really just adds some bookkeeping overhead to the standard allocator.
As for other allocators (like jemalloc or tcmalloc), personally I would prefer if that was left as a decision when linking an application. I don't really want a library forcing me to link with an alternative memory allocator.
I would propose just reverting back to plain old malloc
/free
et. al. I'll put together a PR if you like. I've started working to that end a bit by cleaning up the CMake files:
I am trying to use
r3
andzlib
in the same project. The problem is that both seem to define azcalloc
function:Can I configure
r3
to not use its ownzalloc
, and instead use the one specified byzlib
?