News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to optimize memory.

Started by kyo, October 20, 2006, 07:41:37 AM

Previous topic - Next topic

kyo

I am new to assembly and still learning it to make serious solutions.I was surprised to see that a many applications in the memory take 500 to 700 kbs only eg,SMSS.EXE  some one can say that they are the part of os and might not have the UI. There are other applications also that take very low memory i had a hash decoder made in Delphi 7.0 when the window of that program is in foreground then it take 1,066 to 700 kbs only  :U and when in background it takes 400kb's to 500kb only and this is a working application. Where as i look to my assembly (MASM32) application i was surprised the hello world window which does nothing taker 1,288  :eek . How do we make our application use less memory.

hutch--

kyo,

Its the method for testing memory usage that is suspect, when you use the system method, it calculates system DLLs that are already in memory which is not really correct. An idling window that calls the bare minimum of system DLLs probably has the lowest memory usage under that calculation method. One way to test an app's memory usage is to run many instances of it and look at the increase in memory usage.

A test that is a bit more complicated is to start a large number of identical apps and check the collective memory usage. The general drift is system DLLs are shared so adding their memory usage to each app that calls it is not an accurate method for system wide memory usage evaluation.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Relvinian

Kyo,

One thing to realize when you are programming for any operating system is that there will *always* be a minimum amount of memory used by a program.  A very simple DO NOTHING program can take over 700k. All Windows programs have the Kernel32 loaded into memory along with your applcation. As your program does more and more, you'll be loading more and more system DLLs which will increase the "base" memory of your application.  There's nothing to be worried about because that is all natural.

Relvinian

gabor

Hello!

I can only agree on the opinions above. Just one notice.
Why should a simple code consume 500-700kB? Why do we think that this is okay? Because there is a huge memory module sitting in my machine.
Many of us have created not so simple codes far below 100kB. By this I'd like to say that especially when coding in asm I believe that getting a small executable shouldn't be a big expectation.

Greets, Gábor

Igor

One question... if the reason for reporting large memory consumption or our programs are system dlls, are you saying that other programs like smss.exe don't have system dlls calculated in their memory consumption?

u

The simple truth:

smss.exe uses only ntdll.dll, btw
Please use a smaller graphic in your signature.

u

And let's see a simple app with only a MessageBox and ExitProcess:

Please use a smaller graphic in your signature.