[Lazarus] Thread's stack size

Andreas Berger Andreas at TheBergerClan.org
Mon Jun 15 19:20:57 CEST 2009


David W Noon wrote:
> You need to create a custom class that inherits from TThread. In the
> constructor of your class you can specify a stack size using an
> "inherited" statement. If you want some sample code, just ask.
>   
Yes, since I would need to call the derived TThread's inherited 
constructor and not TThread itself. I wouldn't know how to do that. I 
would especially be interrested in the Linux code since I don't really 
know the Linux API.
> Note also that stack sizes go in multiples of 4KiB (or whatever the page
> size is on the target platform). Moreover, there are no threads that
> "need absolutely no stack", as there can be compiler-generated temporary
> locations, as well as register save areas, that must be placed on the
> stack. So, even if you don't create any local variables, the compiler
> will expect some stack space to be available.
>   
Thanks for the tip. I'll reserve 16K. That should take care of various 
page sizes.

Regards,
Andreas





More information about the Lazarus mailing list