[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Memory Usage



The number printed as MemFree in /proc/meminfo is not really a
good number since the kernel have caches etc that can be 
reclaimed if necessary. But you can use it as a indication of
the minimum amount that is free. 

To test the actual memory available you can do something like this:

int i = 1;
while (1) {
  memset(malloc(100*1024), 0, 100*1024);
  printk("Allocated %d*100KB\n", i++);
}

Note that you should not do this in production code since
the kernel will start to kill processes if the memory is
exhausted.

/Mikael

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com]On">mailto:owner-dev-etrax@xxxxxxx.com]On
Behalf Of Phoenix
Sent: Sunday, May 04, 2003 5:25 PM
To: dev-etrax
Subject: Re: Memory Usage



read "/proc/meminfo" or enable the "free" command of busybox (but you'll
have to re-flash the board)


On Sun, 4 May 2003, Dan Nelson wrote:

> How can I tell how much memory I've used and how much is still available?
> Is there a map file somewhere?  If not, how can I create one?
>
> Dan
>
>