size of a program

This is a discussion on size of a program within the C++ Programming forums, part of the General Programming Boards category; hi . how can I find how much memory a program needs to be run . and is it different ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    177

    size of a program

    hi .
    how can I find how much memory a program needs to be run .
    and is it different with the size of the prpogram ?

  2. #2
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    ->is it different with the size of the prpogram ?
    yes,if i am right.
    ->how can I find how much memory a program needs to be run .
    i know a lot of stupid ways to do this.
    you need someone else to give a good answer.

    blow me ... ...

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    177
    thanks for such a fast reply and ---->

    i know a lot of stupid ways to do this.
    ------------------
    I am ready to hear them

  4. #4
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    no no no no no no no no

    blow me ... ...

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    Which OS/Compiler do you have?

    If you're on linux, you might do
    Code:
    size a.out
    to find the amount of memory the program needs when first loaded into memory.

    As for how much dynamic memory, you could use the 'top' and 'ps' commands at a push.

    Code:
    int main ( ) {
      char *a = new char[10];
      //
      delete [] a;
      //
      a = new char[10];
      delete [] a;
    }
    Depending on what you are trying to achieve, do you want 10 (the peak) or 20 (cumulative total)?

  6. #6
    Registered User
    Join Date
    Nov 2003
    Posts
    177
    I use win XP .
    and
    I read an article about memory management and it made a question for me -> if there is any way to find how much memory a program needs .

    yes u r right , I didnt think about dynamic memory (what a stupid mistake).

    now my question is :
    is there any way to find how much memory a program has used (after running it )

    tnx

  7. #7
    Registered User
    Join Date
    Dec 2004
    Posts
    38
    now my question is :
    is there any way to find how much memory a program has used (after running it )
    go to task manager then processes and you can see the memory usage

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    Also, with the processes tab selected, under the view menu you can turn on some more columns that can be usefull, such as Peak memory usage, which I am sure you can figure out what it does.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  9. #9
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    A similar way of measuring the resources used by your program is knowing how much totalprocessor time your program has used. There's a function to find out in <ctime>, and a column for it in Task Manager.

    I myself have always wandered how companies come up with their minimum requirements as far as RAM goes. I need to start researching the subject for my server. There's resources used by both the program, and each individual client.

  10. #10
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    Some variables to consider when deciding 'minimum' requirements might be, for example, on average how many concurrent processes are running. Also, if your program is real-time, execution time is a function of the amount of physical memory you have avaliable, so you may have to consider that as well.

    If you add up the executable size with all the dynamic allocations, you should get a good rough estimate on the size of your program's memory requirements, given you can ignore anything it puts on the stack.
    hasafraggin shizigishin oppashigger...

  11. #11
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Mine'll be tough - number of threads can vary quite significantly...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fixing my program
    By Mcwaffle in forum C Programming
    Replies: 5
    Last Post: 11-05-2008, 02:55 AM
  2. Error with a vector
    By Tropicalia in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2006, 07:45 PM
  3. include and program size
    By PierreB in forum C Programming
    Replies: 3
    Last Post: 04-01-2004, 02:34 AM
  4. Replies: 11
    Last Post: 03-25-2003, 04:13 PM
  5. Replies: 5
    Last Post: 09-03-2001, 09:45 PM

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