TSan’s memory usage profiling currently doesn’t work on Darwin. This patch implements measuring the amount of resident and dirty memory for each memory region. I also removed the GetShadowMemoryConsumption function, which seems to be unused.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/tsan/rtl/tsan_platform_mac.cc | ||
---|---|---|
108 ↗ | (On Diff #75818) | This is not TSan-specific. Should it go into sanitizer-common? |
lib/tsan/rtl/tsan_platform_mac.cc | ||
---|---|---|
108 ↗ | (On Diff #75818) | I would leave it here, unless you have a plan to implement memory profiler for asan on mac. |
143 ↗ | (On Diff #75818) | I suspect this won't compile when SANITIZER_GO is defined. Go does not have HeapMemBeg. |
158 ↗ | (On Diff #75818) | s/shadow_res/meta_res/ |
lib/tsan/rtl/tsan_platform_mac.cc | ||
---|---|---|
108 ↗ | (On Diff #75818) | It definitely makes sense to implement a memory profiler for ASan as well. The main issue is that some common memory profiling tools on macOS don't work against ASanified/TSanified processes because of the huge reserved regions, so this code is the only way to get the amount of dirty/resident memory (for a specific region). I'll leave the code here (in tsan/) for now, but when I get to implement this for ASan, I'll probably move this to sanitizer_common/sanitizer_mac.cc. Sounds good? |
143 ↗ | (On Diff #75818) | Sure, I'll fix that. The Go test is run in "check-all" and "check-tsan" on Darwin, so we'll notice if we break it. (I run those before committing.) |
158 ↗ | (On Diff #75818) | Right, thanks for noticing! |
lib/tsan/rtl/tsan_platform_mac.cc | ||
---|---|---|
108 ↗ | (On Diff #75818) | Sounds good to me. |