From: Albert Siraev <"[cut]stoned"@chat.ru> Newsgroups: comp.os.msdos.djgpp Subject: memory size allocating test Date: Sat, 04 Apr 1998 20:48:54 +0400 Organization: Stoned Interactive Inc. Lines: 494 Message-ID: <35266476.F27FD9AB@chat.ru> NNTP-Posting-Host: ts1-a28.ufa.dial.sovam.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------AA9BF4053C048810B384343D" To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk --------------AA9BF4053C048810B384343D Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit i tested some compilers for memory usage in win32. used platform: Windows 95 OSR2 Russian edition used tools: DLLSHOW for Windows95 by Gregory Brown V 3.2 http://www.execpc.com/~sbd used compilers: Borland C++ 5.01 - Borland Visual C 5.0 - Microsoft Intel C 2.4 Beta B97013 - Intel used M$ Link LCC-Win32 - by Jacob Navia GNU minimalist Win32 - gnu RSXNT 1.4 - by Rainer Schnitker RSXNTDJ 1.31 - by Rainer Schnitker test program: /************ begin: test.c ***********************************/ #include #include static char szAppName[] = "Memory test window"; LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); BOOL Register(HINSTANCE hInstance); HWND Create(HINSTANCE hInstance, int nCmdShow); void Test_OnDestroy(HWND hwnd); #define Test_DefProc DefWindowProc int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { MSG Msg; if (!hPrevInstance) if (!Register(hInst)) return FALSE; if ( !( Create(hInst, nCmdShow) ) ) return FALSE; while ( GetMessage( &Msg, NULL, 0, 0 ) ) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return(Msg.wParam); } BOOL Register(HINSTANCE hInstance) { WNDCLASS WndClass; WndClass.style = CS_HREDRAW | CS_VREDRAW; WndClass.lpfnWndProc = WndProc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW); WndClass.lpszMenuName = NULL; WndClass.lpszClassName = szAppName; return (RegisterClass(&WndClass) != 0); } HWND Create(HINSTANCE hInstance, int nCmdShow) { HWND hwnd = CreateWindow(szAppName, szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if (hwnd == NULL) return hwnd; ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); return(hwnd); } LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_DESTROY: return HANDLE_WM_DESTROY(hwnd, wParam, lParam, Test_OnDestroy); default: return Test_DefProc(hwnd, Message, wParam, lParam); } } void Test_OnDestroy(HWND hwnd) { PostQuitMessage(0); } /************* end: test.c ***********************************/ memory allocating results: /**** borland C++ ****/ compiling: bcc32 -tW win.c size of win.exe : 32768 memory allocated : 49152 /**** intel C ****/ compiling: iccl -c -O2 win.c link win.obj kernel32.lib user32.lib size of win.exe : 21504 memory allocated : 32768 /**** lcc-win32 ****/ compiling: lcc win.c lcclnk win.obj size of win.exe : 8696 memory allocated : 20480 PS: strange console window showed when test.exe started i think lcc-win32 dos'nt not produce native win32 programs. /**** mingw32 gnu minimalist ****/ compiling: gcc win.c -o win.exe -mwindows -O2 strip win.exe size of win.exe : 4096 memory allocated : 20480 /**** RSXNT 1.4 ****/ compiling: gcc -Zwin32 -O2 win.c -o win.exe strip win.exe size of win.exe : 18432 + rsxnt.dll memory allocated : 393219 (!!!!!!!!!!!!!!!) /**** RSXNTDJ 1.31 ****/ compiling: gcc -Zwin32 -O2 win.c -o win.exe strip win.exe size of win.exe : 5120 + rsxnt.dll memory allocated : 20480 (!!!!!!!!!!!!!!!) /**** Visual C++ 5.0 ****/ compiling: cl -O2 -c win.c link win.obj kernel32.lib user32.lib size of win.exe : 21504 memory allocated : 32768 (!!!!!!!!!!!!!!!) rating: Compiler File size Memory allocated GNU minimalist 4096 20480 RSXNTDJ 1.31 5120 20480 lcc-win32 8696 20480 M$ Visual C++ 5.0 & Intel C 21504 32768 Borland C++ 5.01 32768 49152 RSXNT 1.4 18432 393 216 Enjoy! --------------AA9BF4053C048810B384343D Content-Type: text/html; charset=koi8-r Content-Transfer-Encoding: 7bit i tested some compilers for memory usage in win32.

used platform: Windows 95 OSR2 Russian edition
used tools: DLLSHOW for Windows95 by Gregory Brown V 3.2
                 http://www.execpc.com/~sbd
used compilers:

Borland C++ 5.01                 - Borland
Visual C 5.0                          - Microsoft
Intel C 2.4 Beta B97013         - Intel
    used M$ Link
LCC-Win32                           - by Jacob Navia
GNU minimalist Win32            - gnu
RSXNT 1.4                            - by Rainer Schnitker
RSXNTDJ 1.31                       - by Rainer Schnitker
 

test program:

/************  begin: test.c  ***********************************/
#include <windows.h>
#include <windowsx.h>

static char szAppName[] = "Memory test window";

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message,
                                  WPARAM wParam, LPARAM lParam);
BOOL Register(HINSTANCE hInstance);
HWND Create(HINSTANCE hInstance, int nCmdShow);
void Test_OnDestroy(HWND hwnd);

#define Test_DefProc DefWindowProc

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance,
                   LPSTR lpszCmdParam, int nCmdShow)

{
        MSG Msg;

        if (!hPrevInstance)
                if (!Register(hInst))
                        return FALSE;

        if ( !( Create(hInst, nCmdShow) ) )
                return FALSE;

        while ( GetMessage( &Msg, NULL, 0, 0 ) )
        {
                TranslateMessage(&Msg);
                DispatchMessage(&Msg);
        }
        return(Msg.wParam);
}

BOOL Register(HINSTANCE hInstance)
{
        WNDCLASS WndClass;

        WndClass.style = CS_HREDRAW | CS_VREDRAW;
        WndClass.lpfnWndProc = WndProc;
        WndClass.cbClsExtra = 0;
        WndClass.cbWndExtra = 0;
        WndClass.hInstance = hInstance;
        WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
        WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
        WndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW);
        WndClass.lpszMenuName = NULL;
        WndClass.lpszClassName = szAppName;

        return (RegisterClass(&WndClass) != 0);
}

HWND Create(HINSTANCE hInstance, int nCmdShow)
{
        HWND hwnd = CreateWindow(szAppName, szAppName,
                                 WS_OVERLAPPEDWINDOW,
                                 CW_USEDEFAULT, CW_USEDEFAULT,
                                 CW_USEDEFAULT, CW_USEDEFAULT,
                                 NULL, NULL, hInstance, NULL);
        if (hwnd == NULL)
                 return hwnd;
        ShowWindow(hwnd, nCmdShow);
        UpdateWindow(hwnd);

        return(hwnd);
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message,
                                  WPARAM wParam, LPARAM lParam)
{
        switch(Message)
        {
        case WM_DESTROY:
                return HANDLE_WM_DESTROY(hwnd, wParam, lParam, Test_OnDestroy);
        default:
                return Test_DefProc(hwnd, Message, wParam, lParam);
        }
}

void Test_OnDestroy(HWND hwnd)
{
        PostQuitMessage(0);
}

/*************  end: test.c ***********************************/

memory allocating results:

/**** borland C++ ****/
compiling:
bcc32 -tW win.c

size of win.exe        :  32768
memory allocated    :  49152

/**** intel C ****/
compiling:
iccl -c -O2 win.c
link win.obj kernel32.lib user32.lib

size of win.exe        :  21504
memory allocated    :  32768

/**** lcc-win32 ****/
compiling:
lcc win.c
lcclnk win.obj

size of win.exe        :  8696
memory allocated    :  20480

PS: strange console window showed when test.exe started
i think lcc-win32 dos'nt not produce native win32 programs.

/**** mingw32 gnu minimalist ****/
compiling:
gcc win.c -o win.exe -mwindows -O2
strip win.exe

size of win.exe        :  4096
memory allocated    :  20480

/**** RSXNT 1.4 ****/
compiling:
gcc -Zwin32 -O2 win.c -o win.exe
strip win.exe

size of win.exe        :  18432 + rsxnt.dll
memory allocated    :  393219    (!!!!!!!!!!!!!!!)

/**** RSXNTDJ 1.31 ****/
compiling:
gcc -Zwin32 -O2 win.c -o win.exe
strip win.exe

size of win.exe        :  5120    + rsxnt.dll
memory allocated    :  20480    (!!!!!!!!!!!!!!!)

/**** Visual C++ 5.0 ****/
compiling:
cl -O2 -c win.c
link win.obj kernel32.lib user32.lib

size of win.exe        :  21504
memory allocated    :  32768    (!!!!!!!!!!!!!!!)
 
 
rating:
 
Compiler
File size
Memory allocated
GNU minimalist
4096
20480
RSXNTDJ 1.31
5120
20480
lcc-win32
8696
20480
M$ Visual C++ 5.0 & Intel C
21504
32768
Borland C++ 5.01
32768
49152
RSXNT 1.4
18432
393 216
 
Enjoy!
 
  --------------AA9BF4053C048810B384343D--