2008-03-25 04:54:51 why fwrite cause cached and used memory increasing?
david wang (CHINA)
Message: 52999
Hi,
I've wrotten a simple test just to write video picture captured from v4l to sd card. It's very stranger the test will corrupt after some while. I use a top to see the memory usage and put the test running in background, I saw the memory used and cached is increasing while the test is writing to files. the bytes of memory used and cached increased are almost as much as the bytes wroted to file. when the free memory decrease below 1MBytes, the system corrupt. I chang'ed the file destination to my host pc by nfs, or disable both I-CACHE and D-CACHE , the result is the same. why?
BTW, I use a fwrte to write file, and do a fflush operation after each fwrite.
QuoteReplyEditDelete
2008-03-25 05:08:12 Re: why fwrite cause cached and used memory increasing?
Yi Li (CHINA)
Message: 53000 "memory used and cached is increasing while the test is writing to files"
I think you mean "page cache"? If so, this is normal since linux cache file system data in page cache. But the system crash is not expected - the memory used by page cache is supposed to be reclaimed in low memory condition - what is your kernel version?
QuoteReplyEditDelete
2008-03-25 06:22:29 Re: why fwrite cause cached and used memory increasing?
david wang (CHINA)
Message: 53004
hi YI
Yes, It seems the cache would reclaimed when the free memory is below 1 MBytes also, and the system corrupt is caused by other operation, like open a new socket connection in this time, maybe those program is not safe when they call the malloc function. My question is how to change the lower condition of page cache?
QuoteReplyEditDelete
2008-03-25 07:42:43 Re: why fwrite cause cached and used memory increasing?
Robin Getz (UNITED STATES)
Message: 53008 David:
We can't help if you don't answer Yi's question - "What is your kernel version?"
Thanks
QuoteReplyEditDelete
2008-03-25 22:09:48 Re: why fwrite cause cached and used memory increasing?
david wang (CHINA)
Message: 53018
my kernel version is svn from Oct , 2007. I'll update to the latest version and test again. thank you!
QuoteReplyEditDelete
2008-03-26 11:09:03 Re: why fwrite cause cached and used memory increasing?
david wang (CHINA)
Message: 53063
hi, YI
I've download the latest svn kernel and tried again, but the problem is still there. It seems the free memory increase when it below 1MB also, but it may not safe for some situation. I 'd like to know how to change the low memory condition of the page cache reclaim?