Hi Pascal,

Thanks for the detailed analysis of the potential memory leak. Seems it was a 
treasure trove of issues to look at. I suspected there may be something 
suspicious with some code in Dmitry's Simple Components but the code I looked 
at appeared correct. Looking forward to hear more about the progress on this. 
If I find out more I will share it here on the Gnoga mailing list of course.

Best regards,
Joakim
________________________________________
Från: Pascal <blady-...@users.sf.net>
Skickat: den 1 november 2019 21:25
Till: Joakim Dahlgren Strandberg
Kopia: Gnoga support list
Ämne: Re: [Gnoga-list] Memory leak in Gnoga? False alarm?

> Le 31 août 2019 à 22:18, Joakim Dahlgren Strandberg <joaki...@kth.se> a écrit 
> :
>
> Hi Pascal,
>
> Thanks for taking a look at the memory leak issue. I ran valgrind on 
> tutorial_03. But I did make an adjustment to the On_Exit procedure to be able 
> to stop the gnoga application:
>
>   procedure On_Exit (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
>      App : constant App_Access := App_Access (Object.Connection_Data);
>      View : Gnoga.Gui.View.View_Type;
>   begin
>      App.My_View.Remove;
>      View.Create (App.My_Window.all);
>      View.Put_Line ("Application exited.");
>      App.My_Window.Close_Connection;
>      Gnoga.Application.Multi_Connect.End_Application;    --  <---- Just added 
> this line
>   exception
>   when E : others =>
>         Gnoga.Log (Message => "On_Exit: " &
>                      Ada.Exceptions.Exception_Information (E));
>   end On_Exit;
>
> My platform is Ubuntu 18.04. Here is output from valgrind:
>
> ~/projects/gnoga-code/bin$ valgrind ./tutorial_03
> ==916== Memcheck, a memory error detector
> ==916== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==916== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
> ==916== Command: ./tutorial_03
> ==916==
> Gnoga            :1.5-beta
> Application root :/home/joakim/projects/gnoga-code/
> Executable at    :/home/joakim/projects/gnoga-code/bin/
> HTML root        :/home/joakim/projects/gnoga-code/html/
> Upload directory :/home/joakim/projects/gnoga-code/upload/
> Templates root   :/home/joakim/projects/gnoga-code/templates/
> /js  at          :/home/joakim/projects/gnoga-code/js/
> /css at          :/home/joakim/projects/gnoga-code/css/
> /img at          :/home/joakim/projects/gnoga-code/img/
> Boot file        :boot.html
> HTTP listen on   ::8080
> Multi-connect application.
> Press Ctrl-C to close server.
> 2019-08-31 22:08:10.62 : HTTP Server Started
> 2019-08-31 22:08:15.47 : Requested: Kind: FILE, File: , Query:
> 2019-08-31 22:08:15.55 : Reply: 
> /home/joakim/projects/gnoga-code/html/boot.html (text/html)
> 2019-08-31 22:08:15.57 : Requested: Kind: FILE, File: js/jquery.min.js, Query:
> 2019-08-31 22:08:15.58 : Reply: 
> /home/joakim/projects/gnoga-code/js/jquery.min.js (text/javascript)
> 2019-08-31 22:08:15.60 : Requested: Kind: FILE, File: js/boot.js, Query:
> 2019-08-31 22:08:15.60 : Reply: /home/joakim/projects/gnoga-code/js/boot.js 
> (text/javascript)
> 2019-08-31 22:08:15.74 : New connection - ID 1
> 2019-08-31 22:08:16.34 : Sending to default route for Mozilla/5.0 (X11; 
> Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 on Linux x86_64 
> from 127.0.0.1:53526
> 2019-08-31 22:08:19.84 : Deleting connection - 1
> 2019-08-31 22:08:19.92 : HTTP Server Stopping
> ==916==
> ==916== HEAP SUMMARY:
> ==916==     in use at exit: 17,592 bytes in 19 blocks
> ==916==   total heap usage: 574 allocs, 555 frees, 177,185 bytes allocated
> ==916==
> ==916== LEAK SUMMARY:
> ==916==    definitely lost: 3,104 bytes in 4 blocks
> ==916==    indirectly lost: 0 bytes in 0 blocks
> ==916==      possibly lost: 0 bytes in 0 blocks
> ==916==    still reachable: 14,488 bytes in 15 blocks
> ==916==         suppressed: 0 bytes in 0 blocks
> ==916== Rerun with --leak-check=full to see details of leaked memory
> ==916==
> ==916== For counts of detected and suppressed errors, rerun with: -v
> ==916== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Hello Joakim,

I have got detailed results from valgrind of memory leaks after Gnoga server 
execution.
There is 4 kinds of them:
- allocation in globals that are not freed before exiting (Watchdog and 
Gnoga_HTTP_Server) -> easy to fix
- allocation in GNAT RTE (initialization, Unbounded_String, String, 
String_Access and exceptions) -> to be reported to AdaCore
- allocation in HTTP server (container) -> to be reported to Dmitry
- allocation in Multi-Connect application for Connection_Data, user guide said:
      --  By default Connection_Data is assumed to be a dynamic object
      --  and freed when the connection is closed.
but it seems not to be the case -> investigation is needed.

Regards, Pascal.
http://blady.pagesperso-orange.fr




_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to