-
-
[求助]用汇编写的程序如何减少内存占用?
-
发表于:
2005-12-2 20:47
7321
-
写了一个最简单的win32汇编程序,没有创建任何界面,也没有做任何事情。但是查看进程发现占用了1M内存。有没有技巧减少它的内存占用呢?(例如调整masm的编译参数?)
汇编代码如下:
.586
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
.data?
hInstance HINSTANCE ?
.code
; ---------------------------------------------------------------------------
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL msg:MSG
.WHILE TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!