37d145c71807801efd9cb02926515c82e84c1c71 braney Wed Feb 7 10:12:23 2024 -0800 set up a mechanism to limit memory through an hg.conf variable diff --git src/hg/lib/hgConfig.c src/hg/lib/hgConfig.c index 8c0d1f9..6e041bc 100644 --- src/hg/lib/hgConfig.c +++ src/hg/lib/hgConfig.c @@ -333,15 +333,28 @@ while ((hel = hashNext(&cookie)) != NULL) { if (startsWith(prefix, hel->name)) slSafeAddHead(&names, slNameNew(hel->name)); } return names; } unsigned long cfgModTime() /* Return modification time of config file */ { char filename[PATH_LEN]; getConfigFile(filename); return fileModTime(filename); } + +void cfgSetMaxMem() +/* Check hg.conf for maxMem. If not set, don't limit memory. Otherwise + * limit memory usage to that number. */ +{ +char *maxMemStr = NULL; + +if ((maxMemStr = cfgOption("maxMem")) != NULL) + { + unsigned long maxMem = atol(maxMemStr); + setMemLimit(maxMem); + } +}