[fpc-pascal] fphttpserver: reduce the stack size of the thread spawned for threaded server
Michael Van Canneyt
michael at freepascal.org
Mon May 18 21:59:15 CEST 2026
On Mon, 18 May 2026, Luca Olivetti via fpc-pascal wrote:
> fpc 3.2.2, for a threaded server this code
>
> constructor TFPHTTPConnectionThread.CreateConnection(AConnection:
> TFPHTTPConnection
> );
> begin
> FConnection:=AConnection;
> FreeOnTerminate:=True;
> Inherited Create(False);
> end;
>
> creates a thread with the default stack size. I want to reduce it.
>
> I'm already using a class derived from TEmbeddedHttpServer (in turn derived
> from TFPCustomHttpServer) so I could simply override the
> CreateConnectionThread of TFPCustomHttpServer, which is virtual.
>
> But the original CreateConnectionThread function is
>
>
> function TFPCustomHttpServer.CreateConnectionThread(Conn: TFPHTTPConnection
> ): TFPHTTPConnectionThread;
> begin
> Result:=TFPHTTPConnectionThread.CreateConnection(Conn,
> FConnectionThreadList);
> end;
>
>
> and I don't have access to FConnectionThreadList
>
>
> what other options do I have?
At this moment, none. The best I can do is add a class variable to allow you to
set its class-type value to a TFPHTTPConnectionThread class descendant,
then that descendant would be used. Then you set this variable at the start.
Another option is to create a ConnectionThreadStackSize variable that would
be used to set the stack size.
Michael.
More information about the fpc-pascal
mailing list