If I use program like scout or stacksnoop (triton+68k), I can see verry big stack used by programs (on the task list) and just few stack really used when the program run on the system.
In fact most of the workbench original programs from AOS use 65ko of stack on the scout.
- Scout or another stack reporter program report really the good number of stack used by all the program on AOS4.1 ???
- Why big stack for all WB programs used on AOS4 ???
NOTE: This is strange to see a big program like dopus4 use just 8ko and contextmenu used 65 ko !!!
A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT SAM440EP on Mapower 3000+AOS4.1
@Mrodfr You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.
Come to think of it, I should probably document this fact in my Modern Amiga Programming article.
It is best to never nitpick about stack size in AmigaOS. Give it plenty of room and always use a stack cookie in your programs.
Prompt "%N.%S> "
Stack 1111111
Alias Clear "Echo NOLINE *"*E[0;0H*E[J*" "
Alias Cls Clear
Alias XCopy "Copy CLONE "
Alias Italic "Echo NOLINE *"*E[3m*""
Alias Bold "Echo NOLINE *"*E[1m*""
Alias Normal "Echo NOLINE *"*E[0m*""
Alias Underline "Echo NOLINE *"*E[4m*""
So it's ready for anything whether that is mencoder, flac, gcc or similair... well, generally it is
Yes, I prefer to use the shell than some gui probably because I do alot of my own batch files
~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~ 1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x 3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
This shell-statup does not look as if you often use the shell.
Here is one which makes some work a bit easier:
set echo off
set _mchar "||"
set _pchar "|"
prompt "*e[0;32m%s*e[0m*n%n> "
stack 100000
alias x endcli
alias exit endcli
alias cls echo "*ec" noline
alias ren rename
alias del delete
alias md makedir
alias cd.. cd /
alias ex execute
alias st status full
alias res resident
alias lc run >nil: limpidclock restart
alias ed run >nil: ed []
alias sn search s:serien []
alias mv run >nil: multiview >con:80/80/300/100/MultiView/AUTO/CLOSE/WAIT []
alias cc execute s:cc []
alias say rx "numeric digits 14; pi = 3.14159265358979323846; e = 2.7182818284590452354; say []"
alias find list all lformat=%p%n p=[]
alias ascii rx "do i=0 to 255 by 32; l = ''; if i >= 32 & i < 128 | i >= 160 then do j=0 to 31; l = l || d2c(i+j); end; say l; end"
alias ppaint run >nil: ppaint:ppaint
alias touch setdate
alias ccmake dmake
alias address rx "options results; address []"
alias hdtoolbox run >nil: hdtoolbox
alias snoopdos run >nil: snoopdos
alias playcdda copy to audio:b/16/c/2/f/44100 []
alias cleanram delete ram:~(env|clipboards|t|disk.info) all force quiet
;alias picshow share:sources/picshow/picshow
;alias thumb share:sources/picshow/thumb
You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.
Come to think of it, I should probably document this fact in my Modern Amiga Programming article.
It is best to never nitpick about stack size in AmigaOS. Give it plenty of room and always use a stack cookie in your programs.
A hidden stack on AOS4 secure program with GUI if the programmer put less than 60ko of stack on his code source of his program.
You recommend 80ko on the code source of the program (example code on one of the previous thread).
- And for the stack on the Icon ? (become not usefull at all).
- This advice also true for shell program or for shell program ported fom linux ?
A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT SAM440EP on Mapower 3000+AOS4.1
- And for the stack on the Icon ? (become not usefull at all).
The stack can still be increased by setting a higher value in the icon, never decreased, the higher value is always used. This is still useful if say a developer sets a stack cookie but underestimates the programs needs. Or for programs contain recursive code where a some situations will use greater stack. AWeb for example can use a lot of stack for deeply nested tables, but for the majority of cases doesn't need it.
Quote:
- This advice also true for shell program or for shell program ported fom linux ?
Shell programs will often need less stack, but will still be given at least the stack set in DOS prefs. I've found it best to set this to 70 / 80 k. Really with the amount of memory available on a modern 'amiga' worry about wastage is a waste of effort, compared with the extra stability gained by not taking risks with marginal stacks.
Linux ports typical use very big stacks, as the memory usage patterns for linux programs are quite different from a typical native amiga app, and they make big allocations on the stack. Changing that would typically make the port very hard to maintain, so is generally not done.
With blender I did reduce the stack required by some timeing tasks which were originally inheriting the big main stack required for the render / gui loops but these were special cases.
You can verify whether it is working or not using my Ranger tool. Look in the DOS/Processes tab and click on the running process. If a stack cookie is present the "Min:" amount of stack will display that value.
The stack cookie sets up the minimum amount of stack. Icons, the shell's stack setting, DOS prefs and the programmer can also change the size of the stack. The thing to remember is that DOS will always choose the largest of all the stack settings for maximum safety.
You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.
That's something new to me. Thanks telling it. Do this automatic stack swapping exist in the current public Intuition or in newer (beta) versions ?
Rock lobster bit me - so I'm here forever X1000 + AmigaOS 4.1 FE "Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
@kas1e Even 1M is way too much for 95% of programs, but still not enough for 1%. And I'm sure the users on classic machines with only 64M total will love booting their WB to see 3M free :)
What would actually be helpful for developers, is for the OS team and library coders to recommend a minimum stack usage per API: if you use bsd sockets then your app needs minimum stack of 38K, if you use minigl then you need at least 72K, whatever. The code which uses the stack is not always known or knowable to the person setting an application stack size, and testing can't always reveal the worst case depth.
Automatic stack enlargement is stil the holy grail, and hopefully AOS can migrate into 64-bit address space to make that happen.