Bug #10107 Memory leak in view over subquery
Submitted: 23 Apr 2005 0:53 Modified: 28 Apr 2005 15:29
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0-bk OS:
Assigned to: Sergey Petrunya CPU Architecture:Any

[23 Apr 2005 0:53] Sergey Petrunya
Selecting from a view that contains subquery causes memory leaks.

How to repeat:
Run this test
create table t1 as select 1 A union select 2 union select 3;
create table t2 as select * from t1;
create table t3 as select a a,a b from t2;
create view v2 as select * from t3 where 
  a in (select * from t1) or b in (select * from t2);

select * from v2 A where A.a  < 2;

drop view v2;
drop table t1, t2, t3;
And get this:

Warning: Not freed memory segments: 1
Warning: Memory that was not free'ed (880 bytes):
           880 bytes at 0x008cd3c20, allocated at line 3111 in 'sql_select.cc'

Suggested fix:
Figure out where the JOIN::cleanup call is missing
[23 Apr 2005 0:54] Sergey Petrunya
Can't push fix for BUG#8490 because of this, so I'm assigning this to myself
[23 Apr 2005 2:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[25 Apr 2005 0:23] Sergey Petrunya
Pushed into 5.0.5 tree
[28 Apr 2005 15:29] Paul Dubois
Noted in 5.0.5 changelog.