[uClinux-dev] Filling RAM

Erwin Authried eauth at softsys.co.at
Tue Feb 5 15:38:01 EST 2008


Am Dienstag, den 05.02.2008, 12:33 -0500 schrieb DMcLeod:
> Hi,
> 
> I am seeing that as files are created, their approximate size is 
> subtracted from the available memory. For example, assume I have /home  
> mounted from /dev/mtdblock2, which is a jffs2 filesystem on NOR flash. 
> The following procedure reproduces the problem consistently:
> 
> [code]
> ]# cat /proc/mounts
> rootfs        /     rootfs  rw     0 0
> /proc        /proc     proc     rw     0 0
> sysfs        /sys     sysfs     rw     0 0
> /dev/mtdblock2    /home     jffs2     rw,sync 0 0
> 
> ]# cd /home
> ]# grep MemFree /proc/meminfo
> 22588 kB
> ]# dd if=/dev/zero of=1M.dat bs=1M count=1
> ...
> ]# grep MemFree /proc/meminfo
> 21522 kB
> ]# rm 1M.dat
> ]# grep MemFree /proc/meminfo
> 22576 kB
> [/code]
> 
> I'm fairly certain the file does get written to flash as it is 
> noticeably slower than creating a file of the same size in ramfs. So it 
> seems like the file is stored in RAM as well, how/why would this happen?

Hi,
all file system read/writes go through the buffer cache. You should google 
for "buffer cache" to learn how it works. You can prevent cacheing by 
using the O_DIRECT flag with open() calls.

Regards,
Erwin




More information about the uClinux-dev mailing list