amount of free memory

amount of free memory

Post by Overnu » Fri, 22 Dec 2000 19:06:05



Hello,
I'm doing a C application that uses threads (with the pthread stuff)
I need to know the amount of free memory for my thread and also for
the system.

Is there a function that can give me it ??
Where can I find it ?

I've take a look in the 'ps' command source code, but I haven't found
the stuff.   :-(

Can you help me ?

Thanks.

Overnuts.
Quand y bricole, attendez de voir les outils qu'il sort,
attrapez votre telephone et faites le 17 ou le 18 en consequence...

 
 
 

amount of free memory

Post by Roland Smit » Sat, 23 Dec 2000 06:11:37



> Hello,
> I'm doing a C application that uses threads (with the pthread stuff)
> I need to know the amount of free memory for my thread and also for
> the system.

What kind of memory, stack or heap?

Quote:> Is there a function that can give me it ??
> Where can I find it ?

You can read general memory info in /proc/meminfo.

Per-process info can be found in in the /proc/PID/* files, where PID is the
process-id of the process concerned. The format of these files is described
in the file proc.txt in the kernel's Documentation directory.

If you want info on the per-thread stack space, you'd have to read the
pthread documentation, I guess.

HTH,

Roland

--
Roland Smith                        "When life hands you a lemon,

http://www.xs4all.nl/~rsmith/