[ECOS] YAFFS memory usage

Ross Younger wry@ecoscentric.com
Fri Jul 3 14:30:00 GMT 2009

Earlier this week, I wrote:
> I should raise a flag about YAFFS memory usage. [...]
> I am in the process of composing a post to the YAFFS mailing list raising
> this and will see what the folks there say.

http://lists.aleph1.co.uk/lurker/message/20090701.190059.23524635.en.html is
the response I got from Charles Manning, though the aleph1 site is down as I
type this.

In short, my measured figures[*] are in line with expectations, and the
calculations I had found on yaffs.net are out of date; Charles has provided
a revised calculation which I am working into my package's docs.

[*] 10000 files x 10240 bytes consumed a little over 1.6M of heap

The two main consumers of RAM at runtime are:

1. Every object in the fs (files, directories) takes 120 bytes.

2. Every NAND page used by every file requires a Tnode entry.
  * Entries are allocated to file structs in groups of 16 at a time.
  * The size of a _single_ Tnode entry is the number of _bits_ required to
number all the pages in the NAND partition YAFFS is using, numbered from
_one_; this is rounded up to a multiple of 2, and has an absolute minimum of
sixteen bits.

This represents the bulk of heap usage for all but the simplest filesystems.
The device struct itself, internal page cacheing, and the internal Tnode
tree nodes push consumption out a little further, not to mention the heap's
own overheads.


Embedded Software Engineer, eCosCentric Limited.
Barnwell House, Barnwell Drive, Cambridge CB5 8UU, UK.
Registered in England no. 4422071.                  www.ecoscentric.com

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list