Virtual Memory utilization during run-time

This is a discussion on Virtual Memory utilization during run-time within the C Programming forums, part of the General Programming Boards category; How can we dynamically determine 1) either in bytes or 2) percentage of total available memory used during the run-time ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    10

    Virtual Memory utilization during run-time

    How can we dynamically determine 1) either in bytes or 2) percentage of total available memory used during the run-time of a C/C++ program.

    I am using an iterative computational & memory intensive algorithm. The memory / computational needs for the nth iteration can only be determined at the (n-1)th and nth iteration.

    Hence cannot pre-calculate the memory utilization. Any pointers will be helpful.

    Thanks,

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by wots_guge
    How can we dynamically determine 1) either in bytes or 2) percentage of total available memory used during the run-time of a C/C++ program.

    I am using an iterative computational & memory intensive algorithm. The memory / computational needs for the nth iteration can only be determined at the (n-1)th and nth iteration.

    Hence cannot pre-calculate the memory utilization. Any pointers will be helpful.

    Thanks,
    I'm not sure, this might be a very stupid hint but... *nix has the command free wich seems to do it for you, obviusly it is the current free memmory of the system.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    8
    What operating system?

    Windows use GetProcessMemoryInfo()

    Linux use /proc/self/stat or possibly other entries

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex and Shared Memory Segment Questions.
    By MadDog in forum Linux Programming
    Replies: 14
    Last Post: 06-20-2010, 04:04 AM
  2. Replies: 7
    Last Post: 02-06-2009, 11:27 AM
  3. Run time differences in Linux gcc versions
    By circuitbreaker in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2008, 10:09 PM
  4. Replies: 4
    Last Post: 01-13-2008, 01:14 AM
  5. Replies: 1
    Last Post: 03-30-2004, 01:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21