mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-05-30 00:40:42 +00:00
Log how much memory exceeded maximum by
This commit is contained in:
parent
08c039f522
commit
b6dbc6efa6
1 changed files with 16 additions and 10 deletions
26
EcProcess.m
26
EcProcess.m
|
@ -6516,16 +6516,22 @@ With two parameters ('maximum' and a number),\n\
|
|||
[self alarm: a];
|
||||
}
|
||||
}
|
||||
if (memMaximum > 0 && memPeak > (memMaximum * 1024 * 1024))
|
||||
{
|
||||
if (NO == memRestart)
|
||||
{
|
||||
memRestart = YES;
|
||||
NSLog(@"MemoryMaximum exceeded ... initiating restart");
|
||||
[self ecRestart: @"memory usage limit reached"];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (memMaximum > 0)
|
||||
{
|
||||
int64_t excess = memPeak - (memMaximum * 1024 * 1024);
|
||||
|
||||
if (excess > 0)
|
||||
{
|
||||
if (NO == memRestart)
|
||||
{
|
||||
memRestart = YES;
|
||||
NSLog(@"MemoryMaximum exceeded by %ll bytes"
|
||||
@" ... initiating restart", (long long)excess);
|
||||
[self ecRestart: @"memory usage limit reached"];
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setMemBase();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue