* (global): added --no-mem-optimization flag

This commit adds a new command-line argument that disables memory
optimizations AGH is using. These memory optimizations might be
necessary on low-memory devices, but they aren't free and there's a
performance hit (see #2044). Now they can be disabled - just pass
--no-mem-optimization when you run AGH or when you install the service
-- ./AdGuardHome -s install --no-mem-optimization

Closes: #2044
This commit is contained in:
Andrey Meshkov
2020-09-11 13:19:37 +03:00
parent cb8afde629
commit b3a68bb806
4 changed files with 60 additions and 32 deletions

View File

@@ -24,7 +24,11 @@ type options struct {
// runningAsService flag is set to true when options are passed from the service runner
runningAsService bool
glinetMode bool // Activate GL-Inet mode
// disableMemoryOptimization - disables memory optimization hacks
// see memoryUsage() function for the details
disableMemoryOptimization bool
glinetMode bool // Activate GL-Inet compatibility mode
}
// functions used for their side-effects
@@ -151,6 +155,13 @@ var noCheckUpdateArg = arg{
func(o options) []string { return boolSliceOrNil(o.disableUpdate) },
}
var disableMemoryOptimizationArg = arg{
"Disable memory optimization",
"no-mem-optimization", "",
nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
}
var verboseArg = arg{
"Enable verbose output",
"verbose", "v",
@@ -194,6 +205,7 @@ func init() {
pidfileArg,
checkConfigArg,
noCheckUpdateArg,
disableMemoryOptimizationArg,
verboseArg,
glinetArg,
versionArg,