I had spent quite a bit of effort ensuring that a C++ application I wrote was consuming very little memory. I then ran top (and other similar Linux commands) and was disappointed to see my application was taking more than I thought it should be. I spent some time digging into where that memory was going, but that was somewhat fruitless. I finally wrote the most simple application I could think of:
int main() {
for(;;)
;
}
and ran top on that. Top reported that my minimalist app was consuming 728K RES and 4,224K VIRT! When I used clang++ instead of g++, that increased to 1,612K RES and 13,264 VIRT! What the heck? I remember the old DOS days when applications couldn't exceed 640K. Now a simple empty for loop is taking even more than that? Clearly I'm missing something. What is it?
BTW, I'm running Mint 8.1.