Hi,
I've developed a web-server application using fpweb. Two webserver applications with the same TFPWebModules, one in CGI and another in FCGI.
With CGI model, I have two TFPWebModules (let's say wm1, wm2) and one TDataModule (dm1). DM1 contains database access and common functions.
My question is, I cannot put any of these modules in the "Auto-create forms". They are just in available forms.
Well, the web modules (wm1 and wm2) seem to be created automatically because the application works even I did nothing to create them.
But where should I create dm1?
Well, I can put it in the OnDataModuleCreate event handler of wm1. For example,
procedure Twm1.DataModuleCreate(Sender: TObject);
begin
dm1 := Tdm1.Create(nil);
Log('wm1 created')
end;
But then, Twm1.DataModuleDestroy is not called even in the CGI model. So I cannot destroy dm1.
If I access web-server again, the dm1 is created again. This is quite big memory loss.
When are the web modules are created? And how can I destroy them?