Eric Gueguiniat wrote:

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 ?

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;

Carlos H. cantu answers:

Memory will be released only at commit of the transaction.

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

Like this post? Share on: TwitterFacebookEmail


Related Articles


Author

Firebird Community

Published

Category

Gems from Firebird Support list

Tags