[gtkada] Ctree memory leak.
RAMatthews
ramatthews at ntlworld.com
Fri Apr 13 00:29:37 CEST 2001
I have noticed that Ctree in versions 1.2.10 and 1.2.11 has a fault
in freeing row data - this leads to a memory leak.
In gtk-ctree.adb we have the package Row_Data and in there we have
the procedure Free_Data:
procedure Free_Data (Data : Data_Type_Access) is
Local_Data : Data_Type_Access;
begin
Deallocate_Data_Type (Local_Data);
end Free_Data;
Note that Deallocate_Data_Type is an instantiation of
Unchecked_Deallocation.
Clearly it is trying to deallocate a local variable that has not
been set to anything - that is we are deallocating null.
I have modified my local copy of the procedure to the following:
procedure Free_Data (Data : Data_Type_Access) is
Local_Data : Data_Type_Access;
begin
Local_Data := Data;
Deallocate_Data_Type (Local_Data);
end Free_Data;
I have found that this works - indeed use of Debug_Pools shows that a
memory leak no longer happens.
Robert A. Matthews
More information about the gtkada
mailing list