[fpc-pascal] Class vs Object type
peter at pblackman.plus.com
Wed Apr 6 18:34:31 CEST 2016
On 06/04/16 12:23, Graeme Geldenhuys wrote:
>>From the FPC documentation I noted the following:
> "The difference between objects and classes is mainly that an object is
> allocated on the stack, as an ordinary record would be, and that classes
> are always allocated on the heap."
> Are there pros or cons to either?
> - Graeme -
A comment re stack vs heap on Linux.
Using a recursive routine, I discovered the hard way that
1) the stack is surprisingly small by default (8192Kb)
2) the stack blow error message "broken pipe" is rather unintuitive
The stack may be set to be unlimited (I've done this now), but this is
not usually the default setting.
Regarding the 2nd point, the kernel sends a signal to a process with a
blown stack, but signal processing requires stack space! This might be
fixable by directing the process to use the alternate stack for signal
handling. The error message would hopefully then be more meaningful.
More information about the fpc-pascal