OSDN Git Service
(root)
/
kde
/
kde-workspace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dd535ac
)
Revert "ksysguard: remove the memory leaking scan_one()"
author
Ivailo Monev
<xakepa10@gmail.com>
Sat, 14 Mar 2015 00:23:55 +0000
(
00:23
+0000)
committer
Ivailo Monev
<xakepa10@gmail.com>
Sat, 14 Mar 2015 00:23:55 +0000
(
00:23
+0000)
This reverts commit
dd535ac6f8bcceff75804dfd4eaca6df894e6c70
.
ksysguard/ksysguardd/Linux/Memory.c
patch
|
blob
|
history
diff --git
a/ksysguard/ksysguardd/Linux/Memory.c
b/ksysguard/ksysguardd/Linux/Memory.c
index
21f6b77
..
6b2fcab
100644
(file)
--- a/
ksysguard/ksysguardd/Linux/Memory.c
+++ b/
ksysguard/ksysguardd/Linux/Memory.c
@@
-46,8
+46,22
@@
static unsigned long long STotal = 0;
static unsigned long long SFree = 0;
static unsigned long long SUsed = 0;
static unsigned long long SFree = 0;
static unsigned long long SUsed = 0;
+static void scan_one( const char* buff, const char *key, unsigned long long* val )
+{
+ int o;
+ char *b = strstr( buff, key );
+ if ( b )
+ o = sscanf( b + strlen( key ), ": %llu", val );
+}
+
static void processMemInfo()
{
static void processMemInfo()
{
+ scan_one( MemInfoBuf, "MemTotal", &Total );
+ scan_one( MemInfoBuf, "MemFree", &MFree );
+ scan_one( MemInfoBuf, "Buffers", &Buffers );
+ scan_one( MemInfoBuf, "Cached", &Cached );
+ scan_one( MemInfoBuf, "SwapTotal", &STotal );
+ scan_one( MemInfoBuf, "SwapFree", &SFree );
Used = Total - MFree;
Appl = ( Used - ( Buffers + Cached ) );
Used = Total - MFree;
Appl = ( Used - ( Buffers + Cached ) );