| Deutsch English Français Italiano |
|
<20250123014516.00006d99@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.arch Subject: Re: stack sizes, Segments Date: Thu, 23 Jan 2025 01:45:16 +0200 Organization: A noiseless patient Spider Lines: 51 Message-ID: <20250123014516.00006d99@yahoo.com> References: <bdZeP.23664$Hfb1.16566@fx46.iad> <vmbsvr$3lpar$1@dont-email.me> <vme199$4g29$1@dont-email.me> <b3h0pjhe3gpa84hev3ffbsmq9d3fmcfs49@4ax.com> <vmpml9$1inh$1@gal.iecc.com> <20250122152543.00000682@yahoo.com> <iL7kP.72726$oCrf.34929@fx33.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Thu, 23 Jan 2025 00:45:18 +0100 (CET) Injection-Info: dont-email.me; posting-host="be068643ef2f69aa35144b6a8c0f03c7"; logging-data="1267358"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pEZTcq43Gqi0tNc0aj1cl8r2OW6nmhIM=" Cancel-Lock: sha1:Y9BCk4vE62UV1WCbGWLopjyqWH4= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 3124 On Wed, 22 Jan 2025 15:01:34 GMT scott@slp53.sl.home (Scott Lurndal) wrote: > Michael S <already5chosen@yahoo.com> writes: > >On Wed, 22 Jan 2025 02:54:33 -0000 (UTC) > >John Levine <johnl@taugh.com> wrote: > > > >> According to George Neuner <gneuner2@comcast.net>: > >> >Not standard compliant for sure, but you certainly can approximate > >> >stack use in C: just store (as byte*) the address of a local in > >> >your top level function, and check the (absolute value of) the > >> >difference to the address of a local in the current function. > >> > >> Ugh, but yes that would work with the usual stack structure, > >> > >> >The bigger problem is knowing how much stack is available to use - > >> >there may be no way (or no easy way) to find the actual size ... > >> >or the limit if the stack expands ... and circumstances beyond the > >> >program may have limited it to be smaller than the program > >> >requested. > >> > >> There's often no way to tell since it may depend on things like > >> running out of swap space which depends on how much memory other > >> programs are using. > >> > > > >At least you can know the size of reserved VA space which is both an > >upper bound of the limit and in 99% of the cases an actual limit. > > > >On Windows: > >https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadstacklimits > > > >I suppose that similar functions are available on other OSes as well. > > > > https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_attr_getstack.html > > There is no equivlent function for the main process stack, Do you mean "there is no equivlent *POSIX* function", right? But I sincerily hope that most Unix-like systems provide such functionality in system-specific manner. Because it looks usable. > other than > the 'getrlimit(RLIMIT_STACK...' functionality.