hi .
how can I find how much memory a program needs to be run .
and is it different with the size of the prpogram ?
hi .
how can I find how much memory a program needs to be run .
and is it different with the size of the prpogram ?
->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 ... ...
thanks for such a fast reply and ---->
i know a lot of stupid ways to do this.
------------------
I am ready to hear them
Which OS/Compiler do you have?
If you're on linux, you might doto find the amount of memory the program needs when first loaded into memory.Code:size a.out
As for how much dynamic memory, you could use the 'top' and 'ps' commands at a push.
Depending on what you are trying to achieve, do you want 10 (the peak) or 20 (cumulative total)?Code:int main ( ) { char *a = new char[10]; // delete [] a; // a = new char[10]; delete [] a; }
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
go to task manager then processes and you can see the memory usagenow my question is :
is there any way to find how much memory a program has used (after running it )
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.
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.
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...
Mine'll be tough - number of threads can vary quite significantly...