From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Memory leak - What the ...?
Date: 12 Oct 2004 20:12:47 -0400
Date: 2004-10-12T20:12:47-04:00 [thread overview]
Message-ID: <mailman.293.1097626382.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <dcb57d1e.0410120405.42913054@posting.google.com>
mosteo@gmail.com (Alex R. Mosteo) writes:
> That's it, no leak reported. But running
>
> gnatmem 3 test.exe
>
> I get:
>
> Global information
> ------------------
> Total number of allocations :6001
> Total number of deallocations : 0
> Final Water Mark (non freed mem) : 1.49 Megabytes
> High Water Mark : 1.49 Megabytes
>
> <snip of stacktraces>
>
> Which clearly shows... not a single deallocation !?
SO there's a bug (or feature) in gnatmem on Windows. I suspect GNAT
makes one large request from the OS, and doesn't return it until after
gnatmem finishes. But I'm just guessing.
> (BTW the result is similar without the Debug_Pool). This is wrong.
"wrong" by what GNAT reference manual? "not what I expected", perhaps.
"Wrong" requires a clear definition of what is "right", from the
compiler documentation.
> That's the reason I firstly stated the test case was leaking. Too
> fast jump to conclusions. But linking with -lgmem and running the
> post-mortem gnatmem
>
> gnatmem 10 -i gmem.out test.exe
>
> I get:
>
> Global information
> ------------------
> Total number of allocations :3001
> Total number of deallocations :3000
> Final Water Mark (non freed mem) : 24 Bytes
> High Water Mark : 499.05 Kilobytes
>
> Allocation Root # 1
> -------------------
> Number of non freed allocations : 1
> Final Water Mark (non freed mem) : 24 Bytes
> High Water Mark : 24 Bytes
> Backtrace :
> a-except.adb:1289 ada.exceptions.process_raise_exception
> a-except.adb:2638 <ada__exceptions___elabb>
> b~test.adb:106 adainit
> b~test.adb:189 main
>
> Which is consistent.
Ok.
> I've placed traces in adjust and finalize and they're called as
> expected (some of you have already reproduced this).
>
> However, one thing is absolutely true: changing this type by an all
> static one has removed the leak in my full program.
What leak?
Use Gnat.Debug_Pools for that, as well.
> Since we can agree that the implementation is right, I must be doing
> something different in my program which this test case doesn't show.
> I'll try to summarize all accesses to this type for you, or better
> still to get a faultly test case.
>
> I started this bug chase because I have a program which apparently
> runs fine but that after 24 hours of uptime starts to bog down a
> server (not under my control, one in which I can't get memory usage)
> so it seems plausible that the leak is making it to swap like crazy. I
> didn't suspect of a leak until I observed it in windows, and I haven't
> been back to linux since.
This could also be heap fragmentation, rather than a leak.
--
-- Stephe
next prev parent reply other threads:[~2004-10-13 0:12 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-10 21:33 Memory leak - What the ...? Alex R. Mosteo
2004-10-10 22:05 ` Marius Amado Alves
2004-10-11 8:18 ` Alex R. Mosteo
2004-10-11 11:04 ` Marius Amado Alves
2004-10-11 13:02 ` Martin Krischik
2004-10-11 8:25 ` Martin Krischik
2004-10-11 8:56 ` Martin Dowie
2004-10-11 12:59 ` Martin Krischik
2004-10-11 1:40 ` Stephen Leake
2004-10-11 8:59 ` Alex R. Mosteo
2004-10-11 18:24 ` Stephen Leake
2004-10-12 3:02 ` Brian May
2004-10-12 8:45 ` Jean-Pierre Rosen
[not found] ` <mailman.282.1097576360.390.comp.lang.ada@ada-france.org>
[not found] ` <uvegkc.jrg.ln@skymaster>
2004-10-12 12:31 ` Marius Amado Alves
2004-10-12 14:47 ` Alex R. Mosteo
2004-10-12 16:05 ` Marius Amado Alves
2004-10-12 19:37 ` Björn Persson
2004-10-12 22:10 ` Marius Amado Alves
[not found] ` <416C5646.1020506@netcabo.pt>
2004-10-13 0:17 ` Stephen Leake
[not found] ` <u655f1ng9.fsf@acm.org>
2004-10-13 6:24 ` Marius Amado Alves
[not found] ` <416C00D6.90402@netcabo.pt>
2004-10-13 0:14 ` Stephen Leake
[not found] ` <416BAFA4.7020400@netcabo.pt>
2004-10-13 0:07 ` Stephen Leake
2004-10-13 13:45 ` Hyman Rosen
2004-10-14 9:15 ` Martin Krischik
2004-10-14 17:21 ` Hyman Rosen
[not found] ` <uis9f1nw3.fsf@acm.org>
[not found] ` <mailman.301.1097650377.390.comp.lang.ada@ada-france.org>
2004-10-13 7:40 ` Dmitry A. Kazakov
2004-10-13 17:44 ` Mark Lorenzen
2004-10-14 8:03 ` Dmitry A. Kazakov
2004-10-18 0:33 ` Brian May
2004-10-12 12:05 ` Alex R. Mosteo
2004-10-13 0:12 ` Stephen Leake [this message]
2004-10-13 8:39 ` Pascal Obry
2004-10-13 13:11 ` Memory leak - What the ...? - FOUND Alex R. Mosteo
2004-10-17 0:45 ` Memory leak - What the ...? Brian May
2004-10-13 0:32 ` Matthew Heaney
2004-10-18 0:26 ` Brian May
2004-10-13 0:27 ` Matthew Heaney
2004-10-13 7:58 ` Martin Krischik
2004-10-13 13:01 ` Alex R. Mosteo
2004-10-13 0:25 ` Matthew Heaney
2004-10-13 12:26 ` Stephen Leake
2004-10-13 14:45 ` Matthew Heaney
2004-10-13 23:45 ` Brian May
2004-10-14 1:33 ` Jeffrey Carter
2004-10-11 8:04 ` Martin Dowie
2004-10-12 10:47 ` Alex R. Mosteo
2004-10-12 15:07 ` Alex R. Mosteo
2004-10-13 14:53 ` Matthew Heaney
-- strict thread matches above, loose matches on Subject: below --
2004-10-11 9:50 Christoph Karl Walter Grein
2004-10-11 10:21 Christoph Karl Walter Grein
2004-10-14 4:30 Christoph Karl Walter Grein
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox