Space determine for a C program

227 Views Asked by At

Can I determine the space taken by a C program. Currently I am using GCC compiler on WIndows XP. Actually I want to check how much space consume by the C program.

It is very good if some function tell me the size consume by other function in C.

ex- fun() consume 1028 bytes to run.
1

There are 1 best solutions below

0
On

On disk: Sure: Compile it, make ls or dir.

In memory: No. Just imagine a program that load something from internet into memory. As the memory gets allocated dynamic and you dont know in advance how big the data is, it is impossible to tell the memory usage (in theory thats just a consequence from the halting problem).