[gtkada] memory allocation problems in Gtkada 3.4.2?

Rob Groen robgr at xs4all.nl
Mon Mar 24 15:40:26 CET 2014


The problem is getting worse. Another application that I migrated to 
GtkAda 3.4.2 has the same problems. And that applications does nothing 
"naughty" with Gtkada or Glib. I was able to nail the spot where the 
application crashes. The code is used for reading a text file and 
analyzing its contents and presenting the result in a treeview. After 
reading 46 lines from the input file the application crashes. In that 
piece of code I use allocators. and since the debugger trace showed 
malloc related code I removed the allocators and changed is to something 
that doesn't. Now lo and behold, the applications runs fine. Then, for 
arguments sake in the loop that reads the file I just added one line with
Tmp := new String'("");
The applications crashes again after reading 46 lines. Remove the string 
allocator, all works OK.
I also tried going back to a previous version of the compiler. Same 
results: Gtkada 2.24.2 Ok for both compiler versions, Gtkada 3.4.2 not OK.
I am kind of stuck now. Does anybody experiences the same kind of issues?

Best regards

Rob Groen

On 22/03/14 10:58, Emmanuel Briot wrote:
>> I was afraid that you were going to say something like that. And of course, you are 100% right. Since the code that produces the list of widgets and their get_type functions is generated, I am going to change the generator to generate the with/use clauses and the appropriate gtk_new's. Will post to this list and on this subject again when I have some results.
>
> I actually noticed that in some of the custom GtkAda widgets, we sometimes
> use  G_New (..Get_Type)  to create widgets (see for instance gtkada-multi_paned.adb)
> This might be a good approach for you as well.
>
> regards
> Emmanuel



More information about the gtkada mailing list