by Robert on June 28th, 2009

Robert

Question

Help answer this question below.

How can I find out, through a C prog, how much memory is available?

  • Like
  • Report

Answers. Showing one answer.

  • by vittau on July 15th, 2009

    vittau

    You can make a for loop that will try to malloc an increasingly larger chunk of memory (and then free), and when it fails, this is how much memory you have.
    There surely is a better (and faster) way, but this is the only way I know...

    Oh and this method will count the virtual memory also...

    Comments
    • Like
    • Report

    No comments. Post one | Permalink

Want to attach an image to your answer? Click here.

Did this answer your question? If not, then ask a new question or create a poll.

You're reading How can I find out, through a C prog, how much memory is available?

Follow us on Facebook!

Related Ads