Subject Re: [firebird-support] out-of-memory failure with BLOB
Author Carlos H. Cantu
Re: [firebird-support] out-of-memory failure with BLOB Afair, memory will be released only at commit of the transaction.

Also, keep in mind that each time a blob variable content is changed, FB allocates new memory to store the whole blob!

Carlos
Migration Guide to FB 3
http://www.firebirdnews.org/migration-guide-to-firebird-3/






Hello,

I have a issue with blob in a stored procedure with BLOB variable.
Blob variable is returned by a suspend in a "while do", but the memory allocated to the blob is not released, so  memory takes by fbserver increase until a out of memory failure (up to 2Go, the max size of a 32bit process)

My test was made with fbserverser 3.04 32Bit

To reproduce the issue, just execute the script below
After suspend, allocated memory should be release no ?

Thank you
Eric


SET TERM ^ ;

CREATE OR ALTER PROCEDURE BLOB_MEMORY
RETURNS (
    B BLOB SUB_TYPE 1 SEGMENT SIZE 80)
AS
begin
  b = 'Test';
  suspend;
end^


CREATE OR ALTER PROCEDURE BLOB_MEMORY_TEST
RETURNS (
    B BLOB SUB_TYPE 1 SEGMENT SIZE 80)
AS
declare variable i integer;
begin
  i = 0;
  while (i < 15E6) do
  begin
    select b from BLOB_MEMORY into b;
    i = i+ 1;
    suspend;
  end
end^



SET TERM ; ^

SELECT * FROM BLOB_MEMORY_TEST;