How to compile to reduce memory / STACK does not seem to change anything?

I create many simple programs that do not need memory, but they always show about 1 MB-1.6 MB of memory in the private column of the task manager.

I read that the default stack size is 1 MB for communication with link.exe, I tried to play with / STACK as follows:

/STACK:65536 (64kb)
/STACK:16777216 (16mb)

when I run the program, the memory has not changed at all.

Even a simple program like this, using 1.6MB compiled as 64bit with link.exe and without libs (simple.c):

#include <stdio.h>

int main() {
  puts("hello world\n");
  getchar();
  return 0;
}

- , ? , 1mb , , Windows, taskman, . smss.exe 0.4MB .

!

+3
2

, stdlib , . DLL , , .


STD- Yes (/NODEFAULTLIB) O1 winmain, @_crtstatuperror

#include <windows.h>

int winmain(    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{

    HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
    char out[] = "bob";
    DWORD Outchar = 0 ;    
    WriteConsole(h, out, 4, &Outchar,  NULL);
    return 0;
}

292K, , ,

+3

. Visual Studio /HEAP. ( 1 .)

0

All Articles