ASM can make small executables, however some MASM programs take at least 2 or 3 Mo of RAM once they are loaded under Windows NT. Is there any way to minimize the space required by an application ?
Two or 3 _megs_ in memory, do you mean? That shouldn't be necessary. The default sizes (for MS LINK) of StackReserve and HeapReserve in the PE header are 1 meg each, but LINK has switches /HEAP and /STACK to set these. There is some memory wastage due to SectionAlign. That needs to be 4K (one "page") except in NT, when it can be as little as 32 bytes (one cache line). LINK has a switch /ALIGN, but I haven't tried that one.
Thanks Larry, I will try /HEAP and /STACK.
karim, The link option "/STACK:reserve[,commit]" should do what you require as long as you are not using the stack for large memory demand. I would be inclined to start with a bigger figure that you estimate and tweak it down until the app crashes with a stack fault. Interestingly enough, the nominal 1 meg stack on MASM and other EXE files rarely ever causes a problem because the limit is rarely ever reached. Regards, email@example.com
Karim - The biggest thing to get your head around when it comes to memory usage under windows is the virtual address space. For example, where you said the the program uses 2-3 MB of RAM, your actualy talking about virtual memory, which can be stored on your hard disk (or where ever windows feels like it). And when it comes to the reserved memory for the stack & heap, this memory range is just considered by windows to be reserved, so it wont allocate a memory block in the middle of your stack.
OK thanks for the answers!