#1 2016-01-12 08:13:46

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

How to free a RawByteStringToStream

Hi,

I'm using the fonction "RawByteStringToStream" and I have a simple question: How to free this stream created ?

Thank's


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#2 2016-01-12 17:34:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: How to free a RawByteStringToStream

aStream.Free;

?

Offline

#3 2016-01-13 08:09:03

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: How to free a RawByteStringToStream

I do this :

  temp:=TStream.Create;    
  [...]
  temp := RawByteStringToStream(content);
  [...]
  temp.Free;    

but I have the feeling that the stream is not correctly released.


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#4 2016-01-13 08:16:25

oz
Member
Registered: 2015-09-02
Posts: 95

Re: How to free a RawByteStringToStream

Thomas-Acia wrote:

I do this :

  temp:=TStream.Create;    
  [...]
  temp := RawByteStringToStream(content);
  [...]
  temp.Free;    

but I have the feeling that the stream is not correctly released.

You should use:

  temp := RawByteStringToStream(content);
  try
    [...]
  finally
    temp.Free;
  end;    

Just have a look at RawByteStringToStream() implementation. The stream is created by this function.

Offline

#5 2016-01-13 08:22:40

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: How to free a RawByteStringToStream

Ok thank you I'm going to test !


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

Board footer

Powered by FluxBB