This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18639] poor out-of-memory handling
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Nov 2004 16:49:16 -0000
- Subject: [Bug c++/18639] poor out-of-memory handling
- References: <20041123234237.18639.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-11-24 16:49 -------
This has been discussed numerous times, and the main problem people had
in coming up with better diagnostics is that the operating system does
not communicate to a program why it is being killed. What happens is that
the OS allows you to allocate lots of memory, but it doesn't actually provide
it until you actually start writing to these pages for the first time. At
that time, you write to an invalid page, a signal is raised, and the OS tries
to come up with some physical memory to put behind that address. If it is out
of memory, it can't do that and returns to the application without physical
memory. The program then aborts with an invalid memory access, just as if
you tried to dereference a null pointer. The program itself has no idea what
happened, and the signal handler for the invalid memory access is invoked
which then prints out the error message you have seen.
What would probably have to happen for this to be fixed is to change the
OS so that it gives an indication what is going wrong when it can't satisfy
memory requests. That's a much bigger problem, though, than to just change
a compiler message. After all, we don't want to lose the error message one
gets when the compiler really tries to dereference a null pointer.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18639