emin Posted June 8, 2021 Share Posted June 8, 2021 Hi I use below script to get data from a webservice. Eventhough I make variables free at the end of the process, sometimes I face memory leak warning Thanks in advance for your help function ankarapoliceolustur(sigortali,sigortaettiren,boy,kilo,policebaslangic,indirimorani:string):String; var WS:uAnkaraSaglikDostuWS.ISaglikDostuWS; Police:uAnkaraSaglikDostuWS.SaglikDostu2; Sonuc: QuotationResult2; begin WS := (UniMainModule.HTTPRIOPolice as uAnkaraSaglikDostuWS.ISaglikDostuWS); Police:=uAnkaraSaglikDostuWS.SaglikDostu2.Create; Sonuc:=QuotationResult2.Create; try ...... try Sonuc:=WS.GetQuotation(Police); Result:=inttostr(sonuc.PolicyNumber)+'|'+inttostr(sonuc.EndorsNumber)+'|'+ sonuc.ProductNumber+ '|'+Sonuc.Premium.DecimalString+'|'+inttostr(sonuc.RenewalNumber); except Result:='Failed'; end; finally Police.Free; sonuc.Free; end; end; Quote Link to comment Share on other sites More sharing options...
alfr Posted June 8, 2021 Share Posted June 8, 2021 Hi, I believe you should only create the objects when posting data. When asking for data, the objects is normally created based what are sent from the server to you. So I would skipped the following lines... (and see what happens...) Police:=uAnkaraSaglikDostuWS.SaglikDostu2.Create; Sonuc:=QuotationResult2.Create; Quote Link to comment Share on other sites More sharing options...
emin Posted June 8, 2021 Author Share Posted June 8, 2021 You are right. It works now. Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.