Jump to content

Memory leak


emin

Recommended Posts

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;

 

memory leak.PNG

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...