tips to reduce memory consumption of programs

For every program I write, whether with good algorithm or bad, lengthy or short, always consumes around 2.8 MB. Please suggest me some tips to reduce memory size or possible reasons. I am unable to figure it out myself.

This thread will probably answer all your questions. Still doubts? You may ask here,…

please look at the following pseudocode:

read->t;
while(t–)
{ read->n;
print->(n/2)+1;
}

I implemented the above using only 2 variables in c++ and the program consumes 2.6 MB… I dont know why it is so… Actually I cant understand the above links and the systematic calculation of main memory since I am a newbie… but in my above code I used only 2 integers and performed only basic operation but still takes lots of memory… Please help me with this. Thanks a lot :slight_smile: