mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
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:
@ -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);
|
||||
|
Reference in New Issue
Block a user