Open jcavar opened 5 months ago
We are already interposing the memory allocator with jemalloc, which works cross platforms - a similar small library which also exposes a statistics query api could possibly work - the problem would be that it may have quite significant overhead so we'd only want to preload it if the relevant metrics are enabled. Now we run the actual benchmark as a separate process, so we can probably decide to interpose there...
Can you please help me understand how jemalloc
interposing works? I can't find any extra configuration in the project. Does it rely on the fact that jemalloc
will be linked before libc
and therefore get preference?
Yeah, that's correct.
Hmm, I am not sure if it will work, considering the shared library cache, but I will give it a go.
Hello,
As we briefly touched on here, I wanted to add support for Swift's exclusivity checking metrics.
Unfortunately,
swift_beginAccess
andswift_endAccess
are in theTEXT
section of the binary:This section is not writable, so it is not as easy to hook this as e.g.
_swift_release
, which is inAUTH
section:There are a few options I am aware of that can make this work:
DYLD_INTERPOSE
- This is quite elegant, butDYLD_INTERPOSE
needs to be loaded in a separatedylib
as it needs to register first (I believe this is true, but my understanding of it is not complete)dylib
, but this requires us to introduce an additional dependency to the projectLinux is an additional problem that I have no idea how to address.
Interested to hear your thoughts about it!