Issue Details (XML | Word | Printable)

Key: CORE-3895
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

High memory usage when PSQL code SELECT's from stored procedure which modified some data

Created: 23/Jul/12 08:06 AM   Updated: 17/Nov/16 07:01 AM
Component/s: Engine
Affects Version/s: 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.5.0, 2.1.4, 2.5.1, 2.1.5, 2.5.2
Fix Version/s: 3.0 Alpha 1, 2.1.6, 2.5.3

QA Status: Done successfully


 Description  « Hide
Test case:

1. create metadata
create table t (id integer not null);

set term ^;

create or alter procedure selproc (p_id integer) returns (id integer)
AS
begin
  insert into t values (:p_id);
  id = p_id;
  suspend;
end
^

create or alter procedure main returns (id integer)
as
declare I integer = 0;
begin
  while (i < 1000) do begin
    select id from selproc(:i) into :id;
    i = i + 1;
  end
  suspend;
end
^

set term ;^

2. run test and look at memory usage (below i removed not needed stats)
set stat on;

SQL> select * from main;

          ID
============
         999

Current memory = 4852448
Delta memory = 257764
Max memory = 4859608

SQL> select * from main;

          ID
============
         999

Current memory = 4961764
Delta memory = 109316
Max memory = 4974260

SQL> select * from main;

          ID
============
         999

Current memory = 5071132
Delta memory = 109368
Max memory = 5081956

you see - memory usage is incremented at each run by 109368 bytes

SQL> commit;
Current memory = 4735108
Delta memory = -336024
Max memory = 5081956

memory is returned on commit. But it shoud be returned at the statement execution finish.

If replace "select from selproc" by "execute procedure selproc" then there is no such high memory usage.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.