Drop unused global ProcessList memory fields

The global ProcessList structure contains a couple of unused
fields.  'sharedMem' has never been used by any Meter, since
its not been anything other than zero in Linux /proc/meminfo
for many, many years.  The freeMem field is only used in the
usedMem calculation, so it can reside on the stack like some
other memory variables used within-calculations-only and not
exposed to the user via a Meter.
This commit is contained in:
Nathan Scott
2020-11-27 13:22:21 +11:00
committed by BenBE
parent fee217551c
commit f704baeb82
5 changed files with 3 additions and 24 deletions

View File

@ -1502,6 +1502,7 @@ errorReadingProcess:
}
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
unsigned long long int freeMem = 0;
unsigned long long int swapFree = 0;
unsigned long long int shmem = 0;
unsigned long long int sreclaimable = 0;
@ -1522,8 +1523,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
switch (buffer[0]) {
case 'M':
tryRead("MemTotal:", &this->totalMem);
tryRead("MemFree:", &this->freeMem);
tryRead("MemShared:", &this->sharedMem);
tryRead("MemFree:", &freeMem);
break;
case 'B':
tryRead("Buffers:", &this->buffersMem);
@ -1549,7 +1549,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
#undef tryRead
}
this->usedMem = this->totalMem - this->freeMem;
this->usedMem = this->totalMem - freeMem;
this->cachedMem = this->cachedMem + sreclaimable - shmem;
this->usedSwap = this->totalSwap - swapFree;
fclose(file);