R package for downloading OpenStreetMap data
at main 19 lines 706 B view raw
1vg_check <- function () { 2 vg <- system2 (command = "R", 3 args = c ('-d "valgrind --tool=memcheck --leak-check=full"', # nolint 4 '-f valgrind-script.R'), # nolint 5 stdout = TRUE, stderr = TRUE) 6 7 lost <- NULL 8 types <- c ("definitely lost", "indirectly lost", "possibly lost") 9 for (ty in types) { 10 lost_type <- which (grepl (ty, vg)) 11 n <- regmatches (vg [lost_type], 12 gregexpr ("[[:digit:]]+", vg [lost_type])) 13 lost <- c (lost, as.numeric (n [[1]] [2:3])) 14 } 15 if (any (lost > 0)) 16 stop ("valgrind memory leaks detected!") 17 18 return (TRUE) 19}