Re: Finding the amount of free memory (Was: Optimize causes an error.)

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

 



> > On 7/12/07, NightStrike <nightstrike@xxxxxxxxx> wrote:
> > > On 7/11/07, Rask Ingemann Lambertsen <rask@xxxxxxxxxx> wrote:
> > > > On Tue, Jul 10, 2007 at 05:48:49PM -0400, LWATCDR wrote:
> > > > >
> > > > > And now for a simple question. How the heck to I find out how much
> > > > > free memory I have in c?

> > > >   The longer answer: No system with multitasking can answer that question
> > > > in any useful way because by the time the return value reaches the tasks
> > > > which wants to know, the value is already outdated.
> > >
> > > taskman.exe seems to do it pretty well on a Win32 platform.  Total
> > > physical memory, total physical available memory, system cache, kernel
> > > memory, etc etc.  The value isn't outdated on the order of gigabytes
> > > or hours.  It may not be 100% deterministic, but to say that you can't
> > > do it in any useful way would imply that numeroud system tools that we
> > > have at our disposal are totally useless.
> > >
> > > The reality is that you need to find the right system API for whatever
> > > environment you are in.  Windows provides that, and I'm sure others
> > > do, too.  A simple `cat /proc/meminfo` in a linux system, for example,
> > > will provide all of this data and tons more.

> On 7/12/07, LWATCDR <lwatcdr@xxxxxxxxx> wrote:
> > Yes meminfo will be my final resort. Kind of hoping to find some nice
> > little api that does the same thing.

On 7/12/07, NightStrike <nightstrike@xxxxxxxxx> wrote:
> The API will be OS specific.  What OS are you building for?

On 7/13/07, LWATCDR <lwatcdr@xxxxxxxxx> wrote:
linux

http://www.gnugeneration.com/books/linux/2.6.20/kernel-api/ch05.html

There's every API memory reference for linux that you'll need to
accomplish your task.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux