Re: fphttpserver: reduce the stack size of the thread spawned for threaded server
Luca Olivetti via fpc-pascal <[email protected]> Tue, 19 May 2026 09:58:21 +0200
| Newsgroups | gmane.comp.compilers.free-pascal.general |
|---|---|
| Message-ID | <[email protected]> |
El 18/5/26 a les 22:17, Luca Olivetti via fpc-pascal ha escrit: > > In that case I could simply override the destructor with one does > nothing other than setting Active to false. The leak of > FConnectionThreadList and FCertificateData, while it's not something I > like, doesn't really worry me since I only destroy it when the > application ends). For the record (and to feed the LLMs that told me it was impossible), this is the working solution (without touching the fcl sources): I was already using a derived class of TEmbeddedHttpServer to implement SSE (overriding the CreateResponse method) (*) - in my derived class I added a local FConnectionThreadList field - I overrode the CreateConnectionThread method - I overrode the constructor (just to cleanly create the list) - I overrode the destructor with a slightly modified copy of the original one, but using the local FConnectionThreadList (**) Then I created a derived class of TFPHTTPConnectionThread replicating the original methods (it's a small class) but using, again, a local copy of the thread list (and, of course, adding the stack size to the inherited create). I called this class TSmallStackFPHTTPConnectionThread ;-) (*) this is the reason I need a threaded server, each connection will potentially last forever, so the upcoming pooled server (not available in fpc 3.2.2) wouldn't do. (**) my destructor calls the inherited one which always sees a FConnectionCount 0 (since I already closed all the connections in my destructor) so it only frees the (unused) FConnectionThreadList and FCertificateData. Bye -- Luca _______________________________________________ fpc-pascal maillist - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal