[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Why linux memory management isn't clever, always hold large memroy?



Previously, memory use looks good.  And I use mysql> load data infile
'file' into table to import a very large mysql data file.  So the
memory used became large quickly and soon exhaust all the memory to
use swap space. After that the system became slow for cpu fully
waiting IO status.  (Why mysql or system do not automatic free some of
the loaded data from memory, Just use a little swap space to sawp out
a little memory). After a long time, the mysql load process complete
and I restart the mysqld daemon, but the memory does still hold large
memory.

Why linux does not release the memory again ? Is there any way that I
can free the memory without reboot machine?

Thanks....

shell# free
            total       used       free     shared    buffers     cached
Mem:        516488     459376      57112          0          8     420152
-/+ buffers/cache:      39216     477272
Swap:      1023992         80    1023912


top - 11:20:56 up 46 min,  1 user,  load average: 0.00, 0.00, 0.11
Tasks:  50 total,   1 running,  49 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    516488k total,   459316k used,    57172k free,        8k buffers
Swap:  1023992k total,       80k used,  1023912k free,   420084k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
4002 root      16   0  2228 1124  868 R  0.3  0.2   0:00.02 top
   1 root      16   0  1940  660  564 S  0.0  0.1   0:01.28 init
   2 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
   3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
   4 root      10  -5     0    0    0 S  0.0  0.0   0:00.02 events/0
   5 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper



Reply to: