Subject FWD: [firebird-support] Blob concat consume memory - why?
Author liviuslivius
 
 
Hi,
 
why concating blob consume memory and not leave it until transaction end?
 
simple sample
 
SET TERM ^ ;
 
CREATE PROCEDURE TEST_BLOB_CONCAT 
 ( A BLOB SUB_TYPE TEXT, ILE INTEGER ) 
RETURNS 
 ( B BLOB SUB_TYPE TEXT )
AS 
DECLARE VARIABLE VAR_I INTEGER; 
BEGIN
  VAR_I = 0;
  B = 'ABC';
  WHILE (VAR_I<ILE) DO
    BEGIN
      B = B || A;
      VAR_I = VAR_I + 1;
    END
  SUSPEND;
END^
 
SET TERM ; ^
 
/*----------------------------------------------------*/
 
SELECT * FROM TEST_BLOB_CONCAT('', 5000) 
result 'ABC'
 
consume memory 
________used: 12208
_________max: 38112
_____allocated: 65536
_allocatedmax:  65536
 
/*----------------------------------------------------*/
 
SELECT * FROM TEST_BLOB_CONCAT('', 500000) 
result 'ABC'
 
consume memory 
________used: 12208
_________max: 2338208
_____allocated: 2359296
_allocatedmax:  2359296
 
/*----------------------------------------------------*/
 
SELECT * FROM TEST_BLOB_CONCAT('', 50000000) 
result 'ABC'
 
consume memory all memory from operating system!
 
 
It looks like some temp buffers are created and not freed until transaction end
Is this bug reported or i should report it to the tracker?
 
regards,
Karol Bieniaszewski
 
------------------------------------------------------------------------------------------------------------
 
http://tracker.firebirdsql.org/browse/CORE-4671
 
Helen
 
------------------------------------------------------------------------------------------------------------
 
Hi Hellen,
 
it looks like bug is not fixed only minimized?
I test this with current FB3 snapshot.
 
This fix do only something like this
 
previous before fix
1. transaction start
2. Before execute statement memory low
3. memory increases during statement execution
SELECT * FROM TEST_BLOB_CONCAT('', 50000000)
4. after statement is finished memory is still the same
5. commit transaction ->>> memory relased
 
after fix
1. transaction start
2. Before execute statement memory low
3. memory increases during statement execution
SELECT * FROM TEST_BLOB_CONCAT('', 50000000)
4. after statement ->>> memory relased
5. commit transaction
 
I see that this fix - not fix reason of the bug - only minimize it?
Should i post this as new bug into the tracker or put comment there?
 
 
regards,
Karol Bieniaszewski
 
 
 
I resend this from support group as Helen said.
Why temp blobs are not freed immediately and consume resources? 
 
 
regards,
Karol Bieniaszewski