I set active to false, and added cmem.
I get this result, what should I be getting.
In http_m_listen you should leave the Server.Active := True;
It activates the server.
After that the sleep(500) is executed in the main program.
After that t.Destroy is called in which _T.Server.Active is set to false.
In the http_m_listen the action should continue after Server.Active := true (because that was "blocking")
For me on 32 bit trunk _T.Server.Active := False; doesn't do anything and the program hangs there waiting for the thread in http_m_listen to continue.
On 64 bit the _T.Server.Active := False in api.pas does call closesocket (so the code continues after Server.Active := true) but closesocket generates an exception.
So even with cmem with laz 1.6.4 64 bit (in the project in opening post) you get the exception:
(but no more leak)
main thread
create api
execute api
create http
execute http
destroy api
free resources api
exception http: Could not accept a client connection on socket: 300, error 10004
finish http
destroy http
Heap dump by heaptrc unit
0 memory blocks allocated : 0/0
0 memory blocks freed : 0/0
0 unfreed memory blocks : 0
True heap size : 65536 (224 used in System startup)
True free heap : 65312