[PATCH] D25973: [tsan] Implement WriteMemoryProfile for Darwin

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 13:19:44 PDT 2016


dvyukov added inline comments.


================
Comment at: lib/tsan/rtl/tsan_platform_mac.cc:108
 
-void FlushShadowMemory() {
+static void RegionMemUsage(uptr start, uptr end, uptr *res, uptr *dirty) {
+  vm_address_t address = start;
----------------
kubabrecka wrote:
> dvyukov wrote:
> > zaks.anna wrote:
> > > This is not TSan-specific. Should it go into sanitizer-common?
> > I would leave it here, unless you have a plan to implement memory profiler for asan on mac.
> > sanitizer_common contains too much stuff already.
> > E.g. linux GetMemoryProfile was moved from tsan to sanitizer_common, but it is still used only in tsan. While moving empty stubs were added for other OSes, but the interface is actually such that it cannot be possibly ported to other OSes.
> > Generalizing only one use case does not usually lead to good results.
> 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?
Sounds good to me.


https://reviews.llvm.org/D25973





More information about the llvm-commits mailing list