The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: jckl on March 25, 2006, 08:55:53 AM

Title: /STACK question.
Post by: jckl on March 25, 2006, 08:55:53 AM
In order to compile one of my apps i had to use /STACK 1000000,1000000... My question is would it hurt to always use this when compiling all of my apps?
Title: Re: /STACK question.
Post by: Vortex on March 25, 2006, 09:12:23 AM
For general purpose win32 coding, you don't have to use the switch /STACK
Title: Re: /STACK question.
Post by: asmfan on March 25, 2006, 11:19:06 AM
Vortex,
you are not quite right on this, because i used to write a binary-tree database with deep recursion and i had to use /stack option to avoid overflow.
Title: Re: /STACK question.
Post by: ChrisLeslie on March 25, 2006, 12:10:41 PM
If /stack option is not specified then there must be a default size. Can anybody tell me what it is?
Title: Re: /STACK question.
Post by: jckl on March 25, 2006, 12:35:29 PM
iam not sure if i am right but i was reading somewhere that said default size is 1MB.. Will it hurt to always compile with /STACK even if i didnt need it.. The reason i ask is if i make a batch file to run ml, rc, link ect i wouldnt have to do it for each program i make.. I could pass in the path to link, ml and such while i pass in the file name of the asm file and rc file that needs to be built.
Title: Re: /STACK question.
Post by: hutch-- on March 25, 2006, 12:37:37 PM
Stack size ajustment is normally done with the linker with the StackReserve and StackCommit options. The /STACK switch in masm is a left over from DOS and should not be used.
Title: Re: /STACK question.
Post by: jckl on March 25, 2006, 12:51:17 PM
can you give more info plesase... MSDN didnt return anything on that in my search other than /STACK.
Title: Re: /STACK question.
Post by: hutch-- on March 25, 2006, 01:16:05 PM
Run LINK.EXE /? and read the options.

/STACK:reserve[,commit]
Title: Re: /STACK question.
Post by: jckl on March 25, 2006, 01:26:32 PM
thats what i was doing.... my question is would it hurt if i did that on every app i make even my app dont need that much?
Title: Re: /STACK question.
Post by: hutch-- on March 25, 2006, 01:33:23 PM
Probably not but keep in mind that if an app does not need it, you are reserving more memory than you need and this can come into play on a busy machine. The defaut stack size on a PE file is usually 1 meg and you have to have reasonably deep recursion to go past that.
Title: Re: /STACK question.
Post by: jckl on March 25, 2006, 01:41:07 PM
That answered my question perfectly and is what i thought but i wasnt sure... I guess i can always limit it down or better yet i am not sure ill ever need that much space but it is possibly that i could which is why i had it at that. Thanks for the support  :bg