From c03de0df627864fb7e83e9af88201b8a5fcd4930 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Fri, 29 Mar 2024 20:29:44 -0400 Subject: gc: Find roots using libproc on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the garbage collector found runtime roots on Darwin by shelling out to `lsof -n -w -F n` then parsing the result. However, this requires an lsof binary and can be extremely slow. The official Apple lsof returns in a reasonable amount of time, about 250ms in my tests, but the lsof packaged in nixpkgs is quite slow, taking about 40 seconds to run the command. Using libproc directly is about the same speed as Apple lsof, and allows us to reënable several tests that were disabled on Darwin. Change-Id: Ifa0adda7984e13c15535693baba835aae79a3577 --- src/libutil/regex.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/libutil/regex.hh (limited to 'src/libutil/regex.hh') diff --git a/src/libutil/regex.hh b/src/libutil/regex.hh new file mode 100644 index 000000000..744a7d54a --- /dev/null +++ b/src/libutil/regex.hh @@ -0,0 +1,11 @@ +#pragma once +///@file + +#include +#include + +namespace nix::regex { +std::string quoteRegexChars(const std::string & raw); + +std::regex storePathRegex(const std::string & storeDir); +} -- cgit v1.2.3