Author: Charles Manning Date: To: yaffs Subject: Re: [Yaffs] About nDeletedFiles and nUnlinkedFiles
On Friday 29 November 2013 03:31:25 Oğuzhan Zilci wrote: > Dear All,
>
> I'm a very new to YAFFS2 and had little experience on flash file systems.
> We are using YAFFS2 on a 512 MB NAND Chip on an embedded uclinux system.
> After some read/write/delete etc operations on flash, nDeletedFiles and
> nUnlinkedFiles (obtained from /proc/yaffs) becomes about 30k-40k and memory
> footprint of yaffs becomes about 5MB. I test this by running "free" command
> before and after mounting yaffs2. Are we doing something wrong, is this an
> expected value? We are running low on system memory and need ever bit of
> it, can we do some periodic operation (on user space is preferred rather
> then kernel) to check and clean up nDeletedFiles. I guess since about 5% to
> 10% of the flash is used in or system, garbage collection mechanism is not
> started (may be not necessary?), but we need something like that. Creating
> a huge file on flash (about the size of it) then deleting it increases free
> memory again. Any comment, suggestion, method, idea is welcomed.
What is happening is that when files in Yaffs2 are deleted, the objects still
persist in memory until the space where they live is cleared by garbage
collection.
When you write the large file this forces the garbage collection to happen and
clean up those files.
It sounds like you are not using background garbage collection. That will
cause the deleted file data to be freed up.