Comments (5)
@SamSaffron I had the same idea after seeing it on HackerNews yesterday. I was able to build a shared library using code in #16.
Benchmarks were run on Linux 5.6.7, AMD 2700, compiled with gcc 9.3.0
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
built-in mem: 170800 duration: 4.936174764
built-in mem (MALLOC_ARENA_MAX=2): 139292 duration: 5.318339345
tcmalloc 2.7 mem: 172408 duration: 4.401484569
tcmalloc 2.7.90 mem: 173216 duration: 4.773377773
jemalloc 5.0.0 mem: 169692 duration: 4.470789708
jemalloc 5.0.1 mem: 135116 duration: 4.678362483
jemalloc 5.1.0 mem: 168668 duration: 4.454680265
jemalloc 5.2.1 mem: 139296 duration: 4.780960854
google/tcmalloc mem: 197184 duration: 6.906723601
from tcmalloc.
Modifying the BUILD
file to no longer have the linkstatic=1 attribute should produce a libtcmalloc.so.
That said, all of TCMalloc's dependencies (in Abseil) will end up being dynamically linked in that case, so the performance overhead will be higher than necessary.
from tcmalloc.
How to link abseil in tcmalloc.so?
from tcmalloc.
Having a documented way to build a self-contained tcmalloc.so or tcmalloc.a will be very useful.
I am playing with lld with different malloc implementations today (https://gist.github.com/MaskRay/219effe23a767b85059097f863ebc085). For many allocators using them is simply
ld.lld @response.txt -o lld.glibc
ld.lld ~/Dev/mimalloc/out/release/libmimalloc.a @response.txt -o lld.mi
ld.lld ~/Dev/jemalloc/out/release/lib/libjemalloc.a @response.txt -o lld.je
ld.lld ~/Dev/snmalloc/out/release/libsnmallocshim-static.a @response.txt /usr/lib/x86_64-linux-gnu/libatomic.so.1 -o lld.sn
It seems that if a project doesn't use Bazel, it's very difficult to plug tcmalloc into it. (Yeah I know llvm-project has an unofficial util/bazel/
but still it's very unclear how to make it use tcmalloc.)
from tcmalloc.
AFAIK, creating a shared library with Bazel requires a cc_binary()
rule with, at minimum, linkshared = True
; see this part of the Bazel documentation. Depending on the situation, wrangling symbol visibility might also be necessary; see this part of the pybind_extension()
implementation. One could start off by cloning //tcmalloc:tcmalloc
as //tcmalloc:tcmalloc.so
and then tweaking the latter until it works well enough for one's purposes.
from tcmalloc.
Related Issues (20)
- Disabling tcmalloc cache HOT 2
- OSS-Fuzz issue 65919 HOT 1
- OSS-Fuzz issue 66172 HOT 1
- MADV_COLLAPSE
- Failed to build tcmalloc, Error info: junk at end of line HOT 1
- Quick start guide broken
- How to access tcmalloc MallocExtensions? HOT 1
- Help with heap profiler. HOT 1
- Compiling Issues on aarch64 HOT 2
- OSS-Fuzz issue 67559
- GuardedPageAllocator appears in stack trace when ActivateGuardedSampling() has not been called HOT 10
- OSS-Fuzz issue 68039 HOT 1
- OSS-Fuzz issue 68082
- Per cpu cache of bigger sizes HOT 7
- Compiler error HAVE_SBRK HOT 1
- Compilation Error with tcmalloc: ‘static constexpr bool absl::lts_20230125::base_internal::SpinLock::IsCooperative’ is private within this context HOT 1
- Use more memory than default c++ HOT 1
- tcmalloc cannot optimize dynamic memory allocation caused by std::vector. HOT 11
- GWP-ASan may report segv in multi-thread when write_overflow/double_free detected at free?
- Is there a debugging document of tcmalloc? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcmalloc.