Delphi Can
Datasnap free yapmama sorunu. - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: Datasnap free yapmama sorunu. (/showthread.php?tid=4105)



Datasnap free yapmama sorunu. - seci20 - 23-10-2019

Merhaba ustalarım. Datasnap ile dosya alışverişi yapıyorum. FileStream veya Memorystream ile.Sunucudan free işlemini yapıyorum lakin dosya kullanılmaya devam ediyor. Clienttende aynı şekilde free yapıyorum. Nerede hata yapıyorum ? 

Client kodum.

function TServerConnMonitorMethodsClient.QcLoader(FileName: string; var Loader: TStream; var LoaderSize: Int64): Integer;
begin
 if FQcLoaderCommand = nil then
 begin
   FQcLoaderCommand := FDBXConnection.CreateCommand;
   FQcLoaderCommand.CommandType := TDBXCommandTypes.DSServerMethod;
   FQcLoaderCommand.Text := 'TServerConnMonitorMethods.FileDownload';
   FQcLoaderCommand.Prepare;
 end;
 FQcLoaderCommand.Parameters[0].Value.SetWideString(FileName);
 FQcLoaderCommand.Parameters[1].Value.SetStream(Loader, FInstanceOwner);
 FQcLoaderCommand.Parameters[2].Value.SetInt64(LoaderSize);
 FQcLoaderCommand.ExecuteUpdate;
 Loader := FQcLoaderCommand.Parameters[1].Value.GetStream(FInstanceOwner);
 LoaderSize := FQcLoaderCommand.Parameters[2].Value.GetInt64;
 Result := FQcLoaderCommand.Parameters[3].Value.GetInt32;
end;

Serverdaki foksiyon stabil olan özel bir durumu yok.

Loader := TFileStream.Create( FileName, fmOpenRead or fmShareDenyNone);
       Loader.Position := 0;
       LoaderSize := Loader.Size;
Loader .free;



Datasnap free yapmama sorunu. - 3ddark - 24-10-2019

https://stackoverflow.com/questions/39798094/delphi-datasnap-server-memory-leak-using-tfilestream-as-returnvalue

Burayı inceleyebilirsin. Senin sorunun çözümü gibi duruyor.