From: Ludovic Brenta <ludovic.brenta@insalien.org>
Cc: 250076@bugs.debian.org
Subject: Re: Is the Ada run-time required to detect out-of-memory conditions?
Date: Fri, 21 May 2004 19:13:36 +0200
Date: 2004-05-21T19:12:29+02:00 [thread overview]
Message-ID: <87vfipputb.fsf@insalien.org> (raw)
In-Reply-To: 3YmdnQbGo7stujPd4p2dnA@comcast.com
Here are some more data points that seem to confirm my initial
assessment. The process was killed by the kernel when I had 256 MiB
of RAM and 256 MiB of swap. I created additional swap files so I now
have 256 MiB RAM and 4 GiB swap. I now get a Storage_Error after
approximately 192 million iterations.
Ada.Exceptions.Exception_Information outputs:
Exception name: STORAGE_ERROR
Message: heap exhausted
Here is the backtrace at the point where the exception is raised:
(gdb) bt
#0 0x40091950 in __gnat_raise_nodefer_with_msg ()
from /usr/lib/libgnat-3.15p.so.1
#1 0x40091d18 in __gnat_raise_with_msg () from /usr/lib/libgnat-3.15p.so.1
#2 0x40091ab2 in __gnat_raise_exception () from /usr/lib/libgnat-3.15p.so.1
#3 0x40191e3b in __gnat_malloc () from /usr/lib/libgnat-3.15p.so.1
#4 0x08049a27 in test_250076 () at test_250076.adb:13
#5 0x0804978d in main (argc=1, argv=(system.address) 0xbffffce4,
envp=(system.address) 0xbffffcec) at b~test_250076.adb:168
#6 0x401cddc6 in __libc_start_main () from /lib/libc.so.6
`top' indicates that the process takes 2940 MiB of virtual memory. I
think that virtual memory has indeed been exhausted; the limit is 3072
MiB (3 GiB) for all user-space programs, with 1 GiB reserved for the
kernel.
Now, 2940 MiB / 192_650_250 iterations averages 16 bytes per
allocation. Each Integer is theoretically only 4 bytes. So, while
libgnat does indeed reuse previously allocated pages, there is a
non-negligible overhead. Part of this may be due to the necessary
bookkeeping structures in the C library (malloc), but do you think
this might explain such a huge (4x) overhead?
If I remove the exception handler, I get the SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
0x40228ee3 in malloc () from /lib/libc.so.6
Back to the original question, is this normal, or should libgnat turn
the SIGSEGV into Storage_Error?
--
Ludovic Brenta.
next prev parent reply other threads:[~2004-05-21 17:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-20 22:54 Is the Ada run-time required to detect out-of-memory conditions? Ludovic Brenta
2004-05-21 0:44 ` Georg Bauhaus
2004-05-21 0:47 ` Stephen Leake
2004-05-21 0:54 ` Georg Bauhaus
2004-05-21 1:00 ` Stephen Leake
2004-05-21 3:29 ` Robert I. Eachus
2004-05-21 8:04 ` Vinzent 'Gadget' Hoefler
2004-05-21 9:34 ` Martin Krischik
2004-05-21 11:13 ` Wojtek Narczynski
2004-05-21 12:55 ` Martin Krischik
2004-05-21 16:00 ` Robert I. Eachus
2004-05-21 17:13 ` Ludovic Brenta [this message]
2004-05-21 23:41 ` Wojtek Narczynski
2004-05-23 8:20 ` Martin Krischik
2004-05-21 19:58 ` Randy Brukardt
2004-05-21 16:56 ` Mark H Johnson
2004-05-21 17:19 ` Ludovic Brenta
2004-05-21 21:39 ` user
2004-05-21 22:04 ` Ludovic Brenta
2004-05-21 22:11 ` Ludovic Brenta
2004-05-22 11:40 ` Simon Wright
2004-05-25 20:43 ` Is the Ada run-time required to detect out-of-memory Robert I. Eachus
2004-05-25 20:58 ` Duncan Sands
2004-05-25 21:19 ` Ludovic Brenta
2004-05-25 21:31 ` Duncan Sands
2004-05-26 7:09 ` Martin Krischik
2004-05-26 7:38 ` Duncan Sands
2004-05-26 8:16 ` Martin Krischik
2004-05-26 8:34 ` Duncan Sands
2004-05-26 16:20 ` Martin Krischik
2004-05-22 13:40 ` Is the Ada run-time required to detect out-of-memory conditions? Duncan Sands
2004-05-22 14:09 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox