how to get available physical memory on unix

P

pp

hi,

on window we can GlobalMemoryStatusEx() to get the memory status on
the system
do we have any equivalent function on Unix/linux?

can we use BOOST library to memory information on the unix?

please help me.
 
M

Matthias Buelow

pp said:
on window we can GlobalMemoryStatusEx() to get the memory status on
the system
do we have any equivalent function on Unix/linux?

- wrong newsgroup (try comp.unix.programmer, or some Linux newsgroup),
- it is typically possible on a per-system basis but not portably,
- normally programs shouldn't care about this unless you know why, from
your question, I would think you don't.
 
J

James Kanze

Matthias said:
pp wrote:
- wrong newsgroup (try comp.unix.programmer, or some Linux newsgroup),
- it is typically possible on a per-system basis but not portably,
- normally programs shouldn't care about this unless you know why, from
your question, I would think you don't.

Just a nit, but what does the question even mean? What is meant
by "global memory status"? (The subject line suggests one
meaning, but that doesn't make any real sense on a multi-process
system with virtual memory.)
 
M

Matthias Buelow

James said:
but that doesn't make any real sense on a multi-process
system with virtual memory.)

"void main(..)" doesn't make sense either but that's no putting off
MSDN. It also says:

"You can use the GlobalMemoryStatusEx function to determine how much
memory your application can allocate without severely impacting other
applications."

Giving people idiotic ideas seems to be one thing MSDN is really good at.
 
J

James Kanze

"void main(..)" doesn't make sense either but that's no putting off
MSDN. It also says:

"void main()" actually does make sense. But it won't compile
with a conforming compiler.
"You can use the GlobalMemoryStatusEx function to determine
how much memory your application can allocate without severely
impacting other applications."

Which is still a more or less meaningless statement. Or rather,
one which has no real answer: if the other application is a
numeric simulation program, using a number of arrays of several
million elements, the amount of memory my process can use
without severely impacting it is considerably less than if the
other process is a simple search program, which never holds more
than a single line in memory at a time.
 
P

pp

"void main()" actually does make sense. But it won't compile
with a conforming compiler.


Which is still a more or less meaningless statement. Or rather,
one which has no real answer: if the other application is a
numeric simulation program, using a number of arrays of several
million elements, the amount of memory my process can use
without severely impacting it is considerably less than if the
other process is a simple search program, which never holds more
than a single line in memory at a time.

--
James Kanze (GABI Software) email:[email protected]
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

thanks for you replies.

see guys thats ok if we are not getting the actual information abt the
memory.
there job is to provide the functionality if dont want to use dont
use.

the thing is posted this question because i was looking for an answer.
everyone has different opinions.

can someone please tell how can we achieve the same fuctionality on
unix like GlobalMemoryStatusEx .
 
J

James Kanze

[...]
can someone please tell how can we achieve the same
fuctionality on unix like GlobalMemoryStatusEx .

First, you'd have to ask in a Unix group, not here. And second,
you'll have to explain what the functionality of
GlobalMemoryStatusEx is. Finally, it's also very possible that
the answer depends on which Unix is being used.

(A quick look at the Microsoft documentation indicates that the
function returns quite a bit of information. None of it really
of any use to a classical application. But Unix must have some
equivalent, since there are programs, such as top, which display
this information on the screen.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top