Mail Archives: djgpp/1998/04/04/10:09:15
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
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
--------------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 <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
Content-Type: text/html; charset=koi8-r
Content-Transfer-Encoding: 7bit
<HTML>
i tested some compilers for memory usage in win32.
<P>used platform: Windows 95 OSR2 Russian edition
<BR>used tools: DLLSHOW for Windows95 by Gregory Brown V 3.2
<BR>
<A HREF="http://www.execpc.com/~sbd">http://www.execpc.com/~sbd</A>
<BR>used compilers:
<P>Borland C++ 5.01
- Borland
<BR>Visual C 5.0
- Microsoft
<BR>Intel C 2.4 Beta B97013
- Intel
<BR> used M$ Link
<BR>LCC-Win32
- by Jacob Navia
<BR>GNU minimalist Win32
- gnu
<BR>RSXNT 1.4
- by Rainer Schnitker
<BR>RSXNTDJ 1.31
- by Rainer Schnitker
<BR>
<P>test program:
<P>/************ begin: test.c ***********************************/
<BR>#include <windows.h>
<BR>#include <windowsx.h>
<P>static char szAppName[] = "Memory test window";
<P>LRESULT CALLBACK WndProc(HWND hwnd, UINT Message,
<BR>
WPARAM wParam, LPARAM lParam);
<BR>BOOL Register(HINSTANCE hInstance);
<BR>HWND Create(HINSTANCE hInstance, int nCmdShow);
<BR>void Test_OnDestroy(HWND hwnd);
<P>#define Test_DefProc DefWindowProc
<P>int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance,
<BR>
LPSTR lpszCmdParam, int nCmdShow)
<P>{
<BR> MSG Msg;
<P> if (!hPrevInstance)
<BR>
if (!Register(hInst))
<BR>
return FALSE;
<P> if ( !( Create(hInst, nCmdShow)
) )
<BR>
return FALSE;
<P> while ( GetMessage( &Msg,
NULL, 0, 0 ) )
<BR> {
<BR>
TranslateMessage(&Msg);
<BR>
DispatchMessage(&Msg);
<BR> }
<BR> return(Msg.wParam);
<BR>}
<P>BOOL Register(HINSTANCE hInstance)
<BR>{
<BR> WNDCLASS WndClass;
<P> WndClass.style = CS_HREDRAW
| CS_VREDRAW;
<BR> WndClass.lpfnWndProc = WndProc;
<BR> WndClass.cbClsExtra = 0;
<BR> WndClass.cbWndExtra = 0;
<BR> WndClass.hInstance = hInstance;
<BR> WndClass.hIcon = LoadIcon(NULL,
IDI_APPLICATION);
<BR> WndClass.hCursor = LoadCursor(NULL,
IDC_ARROW);
<BR> WndClass.hbrBackground =
(HBRUSH) (COLOR_WINDOW);
<BR> WndClass.lpszMenuName =
NULL;
<BR> WndClass.lpszClassName =
szAppName;
<P> return (RegisterClass(&WndClass)
!= 0);
<BR>}
<P>HWND Create(HINSTANCE hInstance, int nCmdShow)
<BR>{
<BR> HWND hwnd = CreateWindow(szAppName,
szAppName,
<BR>
WS_OVERLAPPEDWINDOW,
<BR>
CW_USEDEFAULT, CW_USEDEFAULT,
<BR>
CW_USEDEFAULT, CW_USEDEFAULT,
<BR>
NULL, NULL, hInstance, NULL);
<BR> if (hwnd == NULL)
<BR>
return hwnd;
<BR> ShowWindow(hwnd, nCmdShow);
<BR> UpdateWindow(hwnd);
<P> return(hwnd);
<BR>}
<P>LRESULT CALLBACK WndProc(HWND hwnd, UINT Message,
<BR>
WPARAM wParam, LPARAM lParam)
<BR>{
<BR> switch(Message)
<BR> {
<BR> case WM_DESTROY:
<BR>
return HANDLE_WM_DESTROY(hwnd, wParam, lParam, Test_OnDestroy);
<BR> default:
<BR>
return Test_DefProc(hwnd, Message, wParam, lParam);
<BR> }
<BR>}
<P>void Test_OnDestroy(HWND hwnd)
<BR>{
<BR> PostQuitMessage(0);
<BR>}
<P>/************* end: test.c ***********************************/
<P>memory allocating results:
<P>/**** borland C++ ****/
<BR>compiling:
<BR>bcc32 -tW win.c
<P>size of win.exe : 32768
<BR>memory allocated : 49152
<P>/**** intel C ****/
<BR>compiling:
<BR>iccl -c -O2 win.c
<BR>link win.obj kernel32.lib user32.lib
<P>size of win.exe : 21504
<BR>memory allocated : 32768
<P>/**** lcc-win32 ****/
<BR>compiling:
<BR>lcc win.c
<BR>lcclnk win.obj
<P>size of win.exe : 8696
<BR>memory allocated : 20480
<P>PS: strange console window showed when test.exe started
<BR>i think lcc-win32 dos'nt not produce native win32 programs.
<P>/**** mingw32 gnu minimalist ****/
<BR>compiling:
<BR>gcc win.c -o win.exe -mwindows -O2
<BR>strip win.exe
<P>size of win.exe : 4096
<BR>memory allocated : 20480
<P>/**** RSXNT 1.4 ****/
<BR>compiling:
<BR>gcc -Zwin32 -O2 win.c -o win.exe
<BR>strip win.exe
<P>size of win.exe : 18432
+ rsxnt.dll
<BR>memory allocated : 393219
(!!!!!!!!!!!!!!!)
<P>/**** RSXNTDJ 1.31 ****/
<BR>compiling:
<BR>gcc -Zwin32 -O2 win.c -o win.exe
<BR>strip win.exe
<P>size of win.exe : 5120
+ rsxnt.dll
<BR>memory allocated : 20480
(!!!!!!!!!!!!!!!)
<P>/**** Visual C++ 5.0 ****/
<BR>compiling:
<BR>cl -O2 -c win.c
<BR>link win.obj kernel32.lib user32.lib
<P>size of win.exe : 21504
<BR>memory allocated : 32768
(!!!!!!!!!!!!!!!)
<BR>
<BR>
<BR>rating:
<BR>
<TABLE BORDER COLS=3 WIDTH="100%" BGCOLOR="#66FFFF" >
<TR>
<TD>
<CENTER>Compiler</CENTER>
</TD>
<TD>
<CENTER>File size</CENTER>
</TD>
<TD>
<CENTER>Memory allocated</CENTER>
</TD>
</TR>
<TR>
<TD>GNU minimalist</TD>
<TD>
<CENTER>4096</CENTER>
</TD>
<TD>
<CENTER>20480</CENTER>
</TD>
</TR>
<TR>
<TD>RSXNTDJ 1.31</TD>
<TD>
<CENTER>5120</CENTER>
</TD>
<TD>
<CENTER>20480</CENTER>
</TD>
</TR>
<TR>
<TD>lcc-win32</TD>
<TD>
<CENTER>8696</CENTER>
</TD>
<TD>
<CENTER>20480</CENTER>
</TD>
</TR>
<TR>
<TD>M$ Visual C++ 5.0 & Intel C</TD>
<TD>
<CENTER>21504</CENTER>
</TD>
<TD>
<CENTER>32768</CENTER>
</TD>
</TR>
<TR>
<TD>Borland C++ 5.01</TD>
<TD>
<CENTER>32768</CENTER>
</TD>
<TD>
<CENTER>49152</CENTER>
</TD>
</TR>
<TR>
<TD>RSXNT 1.4</TD>
<TD>
<CENTER>18432</CENTER>
</TD>
<TD>
<CENTER>393 216</CENTER>
</TD>
</TR>
</TABLE>
<BR>Enjoy!
<BR>
<BR> </HTML>
--------------AA9BF4053C048810B384343D--
- Raw text -