forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

changing the stack at runtime?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
KennyT



Joined: 02 Aug 2005
Posts: 276

PostPosted: Fri May 25, 2018 8:47 am    Post subject: changing the stack at runtime? Reply with quote

i think it's true to say that, in an application that uses DLLs, it's only necessary to change the stack value in the link script for the .exe to overcome a stack overflow.

our application has two processes with conflicting stack needs. one needs a small stack (5mb) to avoid grabbing too much memory (with the default value of 50Mb, this process runs out of memory at about 2Gb, with stack set to 5Mb it runs up to 3.5Gb). The other process requires at least 20Mb stack or it gets a stack overflow.

So the question is, can i override the stack at runtime using a switch or do i have to provide different .exe files and ask the users to run the 'other' one if/when they get an error?

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5416
Location: Salford, UK

PostPosted: Fri May 25, 2018 10:25 am    Post subject: Reply with quote

Kenny

The stack size can only be set when linking.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 454
Location: Morrison, CO, USA

PostPosted: Fri May 25, 2018 5:12 pm    Post subject: Reply with quote

So, this is a 64-bit application, right? Just curious...
Back to top
View user's profile Send private message Visit poster's website
KennyT



Joined: 02 Aug 2005
Posts: 276

PostPosted: Fri May 25, 2018 5:38 pm    Post subject: Reply with quote

no, 32-bit at the moment.

64-bit to come later.

K
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 1959
Location: Sydney

PostPosted: Fri May 25, 2018 11:16 pm    Post subject: Reply with quote

Can we have a new page in ftn95.chm something like "Stack size for dummies", or more "How to manage the stack"

We need actual examples of:
* how to reset the stack when using Slink or Slink64
* how to find out how big the stack has been set
* how to interrogate a .exe as to what the stack size is
* how to read a .map file to see what the stack size is

(can these features be included in Slink and Slink64, if not available)

Using the stack is probably the most uncertain aspect of program development for all but a few FTN95 users. My approach has always be to try and not use the stack, by not using local or automatic arrays. I use ALLOCATE for any large array.

ps: If this works out, we could then consider another helpful page on "how to use common and modules with DLLs"
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5416
Location: Salford, UK

PostPosted: Sat May 26, 2018 7:39 am    Post subject: Reply with quote

Thanks John. I will make a note of your suggestion.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group