Author: rfm
Date: Thu Jul 9 14:58:57 2015
New Revision: 38779
URL: http://svn.gna.org/viewcvs/gnustep?rev=38779&view=rev
Log:
more tweaks/fixes ... simplify leak alarms
Modified:
libs/ec/trunk/EcProcess.h
libs/ec/trunk/EcProcess.m
Modified: libs/ec/trunk/EcProcess.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.h?rev=38779&r1=38778&r2=38779&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.h (original)
+++ libs/ec/trunk/EcProcess.h Thu Jul 9 14:58:57 2015
@@ -296,7 +296,7 @@
* current peak value) in process memory usage after which
* an alert is generated.<br />
* If this is not set (or is set to a value less than 10KB or
- * greater than 1000000KB) then a value of 5000KB is used.<br />
+ * greater than 1GB) then a value of 5MB is used.<br />
* Setting a higher value makes memory leak detection less
* sensitive (but reduces unnecessary alerts).<br />
* If used in conjunction with EcMemoryPercentage, the greater
@@ -325,7 +325,7 @@
* The increase is calculated as a percentage of the current
* peak memory usage value when an alert is generated.<br />
* If this is not set (or is set to a value less than 1 or
- * greater than 1000) then a value of 10 is used.<br />
+ * greater than 100) then a value of 5 is used.<br />
* Setting a higher value make memory leak detection less
* sensitive (but reduces unnecessary alerts).<br />
* If used in conjunction with EcMemoryIncrement, the greater
Modified: libs/ec/trunk/EcProcess.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=38779&r1=38778&r2=38779&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m (original)
+++ libs/ec/trunk/EcProcess.m Thu Jul 9 14:58:57 2015
@@ -3130,7 +3130,7 @@
Set to 'default' to revert to the default.\n\
With two parameters ('increment' and a number),\n\
the size increment between warnings about process size is set (in KB\n\
- from 10 to 1000000). Set to 'default' to revert to the default.\n\
+ from 10 to 1048576). Set to 'default' to revert to the default.\n\
With two parameters ('percentage' and a number),\n\
the percentage increment between warnings about process memory size is\n\
set (from 1 to 1000). Set to 'default' to revert to the default.\n\
@@ -3244,7 +3244,7 @@
}
else if ([op caseInsensitiveCompare: @"increment"] == NSOrderedSame)
{
- if (val <= 10 || val > 1000000)
+ if (val <= 10 || val > 1048576)
{
[cmdDefs setCommand: nil forKey: @"MemoryIncrement"];
[self cmdPrintf: @"MemoryIncrement using default value.\n"];
@@ -3395,7 +3395,7 @@
@" %"PRIu64"KB (start)\n",
memAvge/1024, memStrt/1024];
[self cmdPrintf: @" %"PRIu64"KB (reserved)\n",
- [self ecNotLeaked]/1024];
+ ((uint64_t)[self ecNotLeaked])/1024];
if (memSlot < MEMCOUNT)
{
[self cmdPrintf: @"Memory error reporting disabled (for %d min"
@@ -4380,39 +4380,29 @@
* the larger.
*/
pct = [cmdDefs integerForKey: @"MemoryPercentage"];
- if (pct < 1 || pct > 1000) pct = 0;
+ if (pct < 1 || pct > 100)
+ {
+ /* Set the next alerting threshold 5%
+ * the current peak usage,
+ * ensuring that only serious increases
+ * in usage will generate an alert.
+ */
+ pct = 5;
+ }
+ pMax = (memPeak * (100 + pct)) / 100;
+
inc = [cmdDefs integerForKey: @"MemoryIncrement"];
- if (inc < 10 || inc > 1000000) inc = 0;
- if (0 == inc && 0 == pct)
+ if (inc < 10 || inc > 1048576)
{
- if (YES == memDebug)
- {
- /* We want detailed memory information, so we set the next
- * alerting threshold 50 KB above the current peak usage.
- */
- inc = 50;
- pct = 0;
- }
- else
- {
- /* We do not want detailed memory information,
- * so we set the next alerting threshold from
- * 5000 KB above the current peak usage,
- * ensuring that only serious increases
- * in usage will generate an alert.
- */
- inc = 5000;
- pct = 10; // Use ten percent if more than fixed increment
- }
+ /* Set the next alerting threshold from
+ * 5MB above the current peak usage,
+ * ensuring that only serious increases
+ * in usage will generate an alert.
+ */
+ inc = 5 * 1024;
}
- if (inc > 0)
- {
- iMax = memPeak + (inc * 1024);
- }
- if (pct > 0)
- {
- pMax = (memPeak * (100 + pct)) / 100;
- }
+ iMax = memPeak + (inc * 1024);
+
memWarn = (iMax > pMax) ? iMax : pMax;
if (memWarn % 1024)
{
@@ -4441,13 +4431,14 @@
{
[self cmdError: @"Average memory usage grown from %"
PRIu64"KB to %"PRIu64"KB (reserved: %"PRIu64"KB)",
- prev/1024, memAvge/1024, [self ecNotLeaked]/1024];
+ prev/1024, memAvge/1024, ((uint64_t)[self ecNotLeaked])/1024];
}
else
{
[self cmdError: @"Average memory usage grown from %"
PRIu64"KB to %"PRIu64"KB (reserved: %"PRIu64"KB) since %@",
- prev/1024, memAvge/1024, [self ecNotLeaked]/1024, when];
+ prev/1024, memAvge/1024, ((uint64_t)[self ecNotLeaked])/1024,
+ when];
}
}
}
@@ -4456,7 +4447,7 @@
{
[self cmdDbg: cmdDetailDbg
msg: @"Memory usage %"PRIu64"KB (reserved: %"PRIu64"KB)",
- memLast/1024, [self ecNotLeaked]/1024];
+ memLast/1024, ((uint64_t)[self ecNotLeaked])/1024];
}
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs