Strange memoryleak with CreateComplexFields and FreeComplexFields
Posted: Tue 14 Aug 2012 17:48
Hello,
I have a strange problem with memoryleak. I'm using tclientdataset-tdatasetprovide-tuniquery. If there is a blob field in query, there is a memory leak. It is not always and not for all queries. I have tried to make demo to reproduce this problem, but with demo app all works ok.
This problem is in our production app. I found this circumstances for my problem:
- when FetchRows=25 everything is always ok. Problem starts with FetchRows>25 for example 100, 200 etc. When =100 there are 8 TOraLob objects leaked, when 200 there are 16 object leaked etc.
- it is all about BLOB fields and CreateComplexField/FreeComplexField functions. The first one is called more times than another one.
I'm trying to debug code with UniDac source, but it's hard to understand code (of course, not my code).
Do you have any ideas about this situation?
XE2 upd4 hotfix 1, 32bit, vcl app, Oracle oci 10g.
Thanks
Zdenek
Edited: this occurs when result is empty (no rows in database)
Edited: I think the problem is in FetchArray (OraClassesUni) in procedure
procedure ClearBlock;
var
i: integer;
Item: PItemHeader;
begin
// Free complex filds
if not HasComplexFields then
Exit;
for i := 0 to FFetchRows - 1 do begin
Item := PtrOffset(Block, sizeof(TBlockHeader) + i * ItemSize);
if Item.Flag <> flFree then //---- HERE THE FLAG IS NOT INITIALIZED BEFORE
FreeComplexFields(PtrOffset(Item, sizeof(TItemHeader)) , True);
end;
end;
I have a strange problem with memoryleak. I'm using tclientdataset-tdatasetprovide-tuniquery. If there is a blob field in query, there is a memory leak. It is not always and not for all queries. I have tried to make demo to reproduce this problem, but with demo app all works ok.
This problem is in our production app. I found this circumstances for my problem:
- when FetchRows=25 everything is always ok. Problem starts with FetchRows>25 for example 100, 200 etc. When =100 there are 8 TOraLob objects leaked, when 200 there are 16 object leaked etc.
- it is all about BLOB fields and CreateComplexField/FreeComplexField functions. The first one is called more times than another one.
I'm trying to debug code with UniDac source, but it's hard to understand code (of course, not my code).
Do you have any ideas about this situation?
XE2 upd4 hotfix 1, 32bit, vcl app, Oracle oci 10g.
Thanks
Zdenek
Edited: this occurs when result is empty (no rows in database)
Edited: I think the problem is in FetchArray (OraClassesUni) in procedure
procedure ClearBlock;
var
i: integer;
Item: PItemHeader;
begin
// Free complex filds
if not HasComplexFields then
Exit;
for i := 0 to FFetchRows - 1 do begin
Item := PtrOffset(Block, sizeof(TBlockHeader) + i * ItemSize);
if Item.Flag <> flFree then //---- HERE THE FLAG IS NOT INITIALIZED BEFORE
FreeComplexFields(PtrOffset(Item, sizeof(TItemHeader)) , True);
end;
end;