comp.lang.ada
 help / color / mirror / Atom feed
* gnatcoll ORM memory leak
@ 2013-04-26 21:49 landgraf
  2013-04-27  1:27 ` Jeffrey Carter
  2013-04-27  6:27 ` Simon Wright
  0 siblings, 2 replies; 5+ messages in thread
From: landgraf @ 2013-04-26 21:49 UTC (permalink / raw)


Hi all. 

I'm playing with ORM in gnatcoll. Compile and run sample application [1]. 
And check valgrind report [2]. 
Did I forget call some free methods?


[1]
--==== main.adb ====--
with ORM; use ORM;
with GNATCOLL.SQL.Sessions; use GNATCOLL.SQL.Sessions;
with GNATCOLL.SQL.Sqlite;
procedure Main is 
    Session : Session_Type; 
begin
    GNATCOLL.SQL.Sessions.Setup
        (Descr  => GNATCOLL.SQL.Sqlite.Setup ("db/gnatleak.db"),
    Weak_Cache => True,
    Max_Sessions => 9);
    Session := Get_new_Session;
    for i in 1..100 loop
        declare
            Ob : Detached_Ob'Class := New_Ob;
        begin
                Ob := New_Ob;
                Ob.Set_Name("myname" & I'Img);
                Session.Persist(Ob);
        end; 
    end loop;
    Session.Commit;
    Free;
end Main;

--=== dbmodel ===--
|TABLE                  | ob
| id                    | AUTOINCREMENT | PK ||| 
|name                   | Text          |NOT NULL     |||


[2]
==31208== 3,200 bytes in 100 blocks are definitely lost in loss record 56 of 57
==31208==    at 0x4C2A87C: malloc (vg_replace_malloc.c:270)
==31208==    by 0x6B55BB7: __gnat_malloc (s-memory.adb:92)
==31208==    by 0x6B70E41: system__pool_global__allocate (s-pooglo.adb:61)
==31208==    by 0x6B810E8: system__storage_pools__subpools__allocate_any_controlled (s-stposu.adb:239)
==31208==    by 0x53A1F3A: gnatcoll__sql__sessions__add_to_cache (gnatcoll-sql-sessions.adb:676)
==31208==    by 0x53A29A0: gnatcoll__sql__sessions__persist (gnatcoll-sql-sessions.adb:666)
==31208==    by 0x40BBD2: _ada_main (in /home/pavel/projects/gnatleak/bin/main)
==31208==    by 0x40CC0B: main (in /home/pavel/projects/gnatleak/bin/main)
==31208== 
==31208== LEAK SUMMARY:
==31208==    definitely lost: 3,200 bytes in 100 blocks
==31208==    indirectly lost: 0 bytes in 0 blocks
==31208==      possibly lost: 0 bytes in 0 blocks
==31208==    still reachable: 6,120 bytes in 58 blocks
==31208==         suppressed: 0 bytes in 0 blocks
==31208== Reachable blocks (those to which a pointer was found) are not shown.
==31208== To see them, rerun with: --leak-check=full --show-reachable=yes
==31208== 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-27  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 21:49 gnatcoll ORM memory leak landgraf
2013-04-27  1:27 ` Jeffrey Carter
2013-04-27  8:00   ` landgraf
2013-04-27  6:27 ` Simon Wright
2013-04-27  8:03   ` landgraf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox