Re: [GD-Windows] autodocument max stack usage
Brought to you by:
vexxed72
From: Corrinne Y. <cor...@sp...> - 2001-10-18 20:06:09
|
----- Original Message ----- From: "Brian Hook" <bri...@py...> To: "'Gamedevlists-Windows@Lists. Sourceforge. Net'" <gam...@li...> Sent: Thursday, October 18, 2001 2:36 PM Subject: RE: [GD-Windows] autodocument max stack usage > More important, why is the size of the stack an issue, other than for > informative reasons? I generally just crank the hell out of my stack in > the linker settings. It shouldn't have any side effects, assuming I > don't use all of it. -- Mmm ... there appears to be possibly some misunderstanding of why stack watching is important in this day and age. Apologies if the information below is elementary, but just in case either of you are not aware, the following are some of the reasons stack watching yields a better user experience. -- The information I have collated is overall stack usage distribution during runtime during development of the project as it grows bigger. It is also interesting to see where it is using too much stack and maybe it can be taken down. -- Therefore it is _extremely possible_, and _extremely informative_ , to find out how much stack the modules are using, not counting that used by other libs, and windows dll. -- An application user should not ever experience stack fault, or failure to start app on their system because there is not enough initial stack. -- (Unless their machine really sucks. :) ) -- The other thing I want to minimize for both performance and robustness reasons is any runtime stack frame allocation. -- On XP, as an example, accidental excessive stack frame locks can be a performance hit. As well as a robustness concern (i.e., it can fail). -- Another reason is (since I had programmed on consoles as well as PC applications) cross console and cross platform behavior. One can assume pushing and popping of stack frames for most PC operating systems, but one cannot assume the same or similar performances on other operating systems and consoles. -- By being able to have a snap and a report how how much stack (and how it is distributed) on 1 platform (i.e., in Visual C). I can very easily move it to other platforms that may have more limited memory requirements. -- I generate the same anal autodocumentation for my memory heap as well. Not only how big my full heap is and needs to be, but also traces of which modules is using how much at what time. -- This information is very helpful when moving to platforms and giving a quick idea where and how to cut. -- Still looking for posts that actually _ANSWER_ the post _TOPIC_! -- Not looking for or reading more posts on why it shouldn't be done or can't be done. -- I guess this is similar to Brian asking about if his distribution is normal, and getting hundreds of hash function back. :) -- As for _alloca, it can be used as the fallback for obtaining scratch memory, but before your scratch queue is initialized. -- _alloca can be a handy function for temp buffer. -- But if you roll your own (temp buffer allocation), you can do even more range safe checks on all your memory situations. -- Again, in XP, it is highly naughty to read memory one does not own. If some of your memory comes from _alloca, you would not have the real "pointer min" and "pointer max" for a heap range check before walking it, or before reading your "magic." Since _alloca can come from (relatively) anywhere. -- But if you roll your own temp stack, you can safely read your magic since you know for sure you own that. -- I have recently become a big fan of handle as much of your own memory as you can, in the simplest manner possible (i.e., no fancy realtime inplace compaction schemes). -- No, and I hold back in custom frame stack allocation schemes as well ... though it is possible, though again too naughty. :) -- So, back to the _TOPIC_. Is there a linker output for it, or not. (even on the module level). P.S. Hate to be cross, but I hate that at this list and some other places, one posts a question, and gets a lot of posts explaining really simple and obvious things that we should all already know. I know it happens to everyone, Brian included, with his hash distribution posts. But wonder if we can ask people can hold that back a bit? |