def try_get_max_rss_kb() -> Optional[int]:
    """Attempts to get the high water mark for this process's memory use via
    the most reliable and accurate mechanism available through the host OS.
    Currently only implemented for Linux."""
    if sys.platform == "linux" and os.path.isfile("/proc/self/status"):
        try:
            # On Linux, the most reliable documented mechanism for getting the RSS
            # high-water-mark comes from the line confusingly labeled VmHWM in the
            # /proc/self/status virtual file.
            with open("/proc/self/status") as f:
                for line in f:
                    if line.startswith("VmHWM:"):
                        return int(str.split(line)[1])
        except Exception:
            pass

    return None
Attempts to get the high water mark for this process's memory use via
    the most reliable and accurate mechanism available through the host OS.
    Currently only implemented for Linux.
core/dbt/utils/utils.py