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

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



On Sun, Oct 08, 2006 at 11:51:46AM +0800, bowen wrote:
> 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?
> 
I used to think the same thing you do now.  However, after reading up
on it, I realize that Linux makes very smart use of memory.  It hurts
nothing to leave memory allocated if it is not needed by another
application.  This is because the cost to free allocated memory and give
to another process is extremely small.  However, if a process requests
something and the system must go to hard disk, this takes a
comparitviley long time.  Aggressively freeing memory means that every
time you need something, you must go back to the hard drive.  This is
definitely not what you want.

Regards,

-Roberto

-- 
Roberto C. Sanchez
http://people.connexer.com/~roberto
http://www.connexer.com

Attachment: signature.asc
Description: Digital signature


Reply to: