Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 08-18-2010, 05:02 PM   #1
LQ Newbie
Registered: Sep 2006
Posts: 17

Rep: Reputation: 0
Query: Embedded System - Total Memory Usage

We have an embedded system here, where we are running everything from RAM. We use CPIO file systems that get loaded into RAM as part of the Kernel image and is mounted as a ramdisk.
Our system has 128M of RAM. We "remove" from the system ~ 28M that we map (physically) for certain needs. That leaves Linux with ~ 100M. When our applications run (and loads libraries/modules, etc), "free" reports how much is used: ~ 44MB.
Yet, I still have a File System occupying Memory that does NOT see to get reported by "free". The uncompressed File system image is ~ 23M
My questions are:
1. How can I determine how much RAM is used by the File System? This would, I believe, need to be added to the "used" memory reported by "free" to determine "total memory used" in the system.
2. Why does free NOT report how much is used by the Filesystem? Since it needs to be there, one would think that it needs to be reported. I find the current "free" implementation to be flawed in this way, since this does reside in memory.
In systems where one mounts the file system on a disk, then yes, I would agree that free reports memory usage accurately.
3. If my application started to use up more memory, at what point would I expect to run into trouble? For example:
Avail Mem = 100M
FileSys = 25M
Running kernel/modules/drivers/libs/apps = 50M
In reality, of 100M, I "really" only have 75M since my FS resides in RAM. So using 50/100 is 50% used where as 50/75 is 67% used, BIG difference.
Would my app be able to use up to 75M or would it use up to 100M? What happens to the FS? Wouldn't something get overwritten? Would the kernel crash, or maybe die gracefully?
I know that the FS won't grow beyond what gets specified when it's built.
TIA for your insights into this, it is greatly appreciated.
Old 08-20-2010, 12:40 PM   #2
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,264

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
It's not that simple. free is a little out of date, iirc, and the figures are not 100%

In windows, a program starts and says "I want 4 megs, 1 now and the rest soon"; windows replies: "Here's 4 megs"
The program might use 500k and windows crashes because it has no memory left :-).
In linux it's more like I want 4 megs! 1 now, and the rest soon
The kernel says 'start writing there. it uses 500k
before long there's many programs all thinking they have ram in the same place. when the second one actually write to it - linux puts whatever the first wrote somewhere else, different ram or swap. It keeps buffers to smooth this.
free according to the docs, no longer keeps up accurately with the sleight of hand of the kernel and misreports the buffers or can do so.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check the memory usage in an embedded Linux system? alanchansl Linux - Embedded & Single-board computer 7 07-24-2008 09:21 AM
most, er, universal way to get system memory total and usage lumix Linux - Newbie 1 06-03-2007 09:30 AM
Command to show each application/process memory usage and its total gn00kie Linux - Enterprise 2 09-21-2006 03:08 AM
Who Customize Linux for an Embedded System usage? Rajaee Linux - Software 0 08-18-2003 03:29 AM
Limiting the total amount of memory usage by apache. Linux - General 8 08-30-2002 09:56 AM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration