From 2b87d9d4df9589780af40440890c1a4a0a870787 Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 6 Jul 2015 18:44:14 +0000 Subject: [PATCH] iMore tolerant alerting git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@38756 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 ++++++++++ EcProcess.h | 15 ++++++++------- EcProcess.m | 14 +++++++------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4805e2b..931115d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2015-07-06 Richard Frith-Macdonald + + * EcProcess.h: + * EcProcess.m: + Various tweaks to leak alert generation. Change default initial + thresholds and change increments after an alert to be based upon + the *peak* usage at the point when the alert was generated, rather + than on the previous threshodld. This reduces the number of alerts + in a process whose memory usage grows rapidly on startup. + 2015-07-03 Richard Frith-Macdonald * EcProcess.h: diff --git a/EcProcess.h b/EcProcess.h index 8055557..0cd820c 100644 --- a/EcProcess.h +++ b/EcProcess.h @@ -103,12 +103,13 @@ EcMemoryIncrement - This integer value controls the (KBytes) increment in process - memory usage after which an alert is generated.
+ This integer value controls the (KBytes) increment (from + current peak value) in process memory usage after which + an alert is generated.
If this is not set (or is set to a value less than ten or greater than a million) then a value of five thousand is used unless EcMemory is set (in which case twenty is used).
- Setting a higher value make memory leak detection less + Setting a higher value makes memory leak detection less sensitive (but reduces unnecessary alerts).
If used in conjunction with EcMemoryPercentage, the greater of the two allowed memory values is used.
@@ -127,12 +128,12 @@ EcMemoryPercentage This integer value controls the increase in the alerting - threshold after which a memory usage alert is generated.
- The increase is calcuilated as a percentage of the current - memory usage value when an alert is generated.
+ threshold after which a memory usage alert is generated.
+ The increase is calculated as a percentage of the current + peak memory usage value when an alert is generated.
If this is not set (or is set to a value less than one or greater than a thousand) then a value of ten is used unless - EcMemory is set (in which one is used).
+ EcMemory is set (in which case a value of one is used).
Setting a higher value make memory leak detection less sensitive (but reduces unnecessary alerts).
If used in conjunction with EcMemoryIncrement, the greater diff --git a/EcProcess.m b/EcProcess.m index c6d7d36..cccf87b 100644 --- a/EcProcess.m +++ b/EcProcess.m @@ -2391,11 +2391,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval); NSInteger iMax = 0; NSInteger pMax = 0; - /* Alert because the average has risen above the allowed size. - */ - [self cmdError: @"Average memory usage grown to %"PRIu64"KB", - memAvge / 1024]; - /* We increase the threshold for the next alert by a percentage * of the existing usage or by a fixed increment, whichever is * the larger. @@ -2429,17 +2424,22 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval); } if (inc > 0) { - iMax = memWarn + (inc * 1024); + iMax = memPeak + (inc * 1024); } if (pct > 0) { - pMax = (memWarn * (100 + pct)) / 100; + pMax = (memPeak * (100 + pct)) / 100; } memWarn = (iMax > pMax) ? iMax : pMax; if (memWarn % 1024) { memWarn = (memWarn / 1024 + 1) * 1024; } + + /* Alert because the average has risen above the allowed size. + */ + [self cmdError: @"Average memory usage grown to %"PRIu64"KB", + memAvge / 1024]; } if (YES == [cmdDefs boolForKey: @"Memory"])