Issue Details (XML | Word | Printable)

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

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

Memory leak when using CTE within procedure

Created: 20/Jul/07 12:20 AM   Updated: 18/Nov/08 02:01 PM
Component/s: None
Affects Version/s: 2.1 Beta 1
Fix Version/s: 2.1 Beta 2

Time Tracking:
Not Specified

Environment: WinXP


 Description  « Hide
1) Create new database
2) Create table and procedure with CTE:

create table t ( id int, parent int )
insert into t (id,parent) values (0,0)
insert into t (id,parent) values (1,0)
insert into t (id,parent) values (2,0)
insert into t (id,parent) values (3,1)

create procedure p ( parent integer)
returns ( id integer)
as
begin
  for with recursive children as (
    select id, parent from t where id=:parent
    union all
    select t.id, t.parent from t join children c on t.parent=c.id and t.id<>c.id
  ) select id from children into id do suspend;
end

3) Run a query:

execute block
as
declare i integer = 0;
declare id integer;
begin
  while (i<200000) do begin
    for select id from p(0) into id do begin end
    i = i + 1;
  end
end

9 Mb of memory is allocated. It is not released after commit or rollback. Only released when disconnected.

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