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)

Best regards,
Joakim
________________________________________
Från: Pascal via Gnoga-list <gnoga-list@lists.sourceforge.net>
Skickat: den 31 augusti 2019 21:18
Till: Gnoga support list
Kopia: Pascal
Ämne: Re: [Gnoga-list] Memory leak in Gnoga? False alarm?

> Le 29 août 2019 à 11:56, Joakim Dahlgren Strandberg <joaki...@kth.se> a écrit 
> :
>
> Hi,
>
> I've used valgrind on tutorial-03 and as far as I can tell Gnoga seems to 
> leak memory. To do it I've added
>       Gnoga.Application.Multi_Connect.End_Application;
> in one of the button click handlers to make it possible to stop the Gnoga web 
> server without using ctrl+c. Is there someone that can verify or refute that 
> memory is being leaked? Evidently David has been running Gnoga web servers 
> for long periods of time (for example http://www.gnoga.com) without memory 
> leak issue but still it would be nice if one could understand why valgrind is 
> reporting that not all memory has been reclaimed when the gnoga web server 
> has shutdown.

Hello Joakim,

I've just do:
$ valgrind bin/plot_test
==27673== Memcheck, a memory error detector
==27673== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==27673== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==27673== Command: bin/plot_test
...

But Gnoga server is not starting.
Which command do you use?
What is your configuration?
I use GNAT Community 2019 on macOS 10.13.

Thanks, 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