Re: [gtk-list] Re: 1.1.5 g_timer_new bug!
- From: Sebastian Wilhelmi <wilhelmi ira uka de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: 1.1.5 g_timer_new bug!
- Date: Tue, 08 Dec 1998 11:07:35 +0100
Hi,
> > it uses g_new and that will fail (i.e. exit), if no memory is available,
> > thus g_new it is guaranteed to return a non NULL value.
> >
>
> I don't want my application to crash ungracefully because a
> timer allocation failed, instead I would prefer to leave this
> to the application itself, so it can do other things or cleanup
> or find ways to deal with it rather than a
>
> *** ERROR **** something != NULL message
> core dumped
This at first glance seems like a sane statement, but if you really think
about it, you will soon see, that only 1e-20 of all written applications
really try to clean up, when the memory is exhausted.
If such a mechanism is provided, almost all applications will just bail.
And this is not by chance. There are two main reasons:
1) for todays programming techniques (i.e. object oriented, which glib is
as well, while not being c++) you need pretty many heap objects, it is
quite reasonable to assume, that also the cleanup would require them ->
you're hosed.
2) if you really can't allocate more memory, that does mean you are in
seriuos trouble anyway, be it, because your application has huge amounts
of unused data lying around or be it, that your program really needs that
much memory, than you will get hosed soon after you cleaned up anyway. It
of course is bad, if there is no memory left, but the application in most
of the cases can't do anything about it, and certainly not save the data.
(see point 1)
And hey, you can increase your virtual mem at almost no extra cost (apart
from reinstalling linux due to repartitioning of course ;-).
--
+--------------============####################============--------------+
| Sebastian Wilhelmi, Institute for Computer Design and Fault Tolerance, |
| University of Karlsruhe; Building 20.20, Room 263, D-76128 Karlsruhe |
| mail: wilhelmi@ira.uka.de; fax: +49 721 370455; fon: +49 721 6084353 |
+-----------------> http://goethe.ira.uka.de/~wilhelmi <-----------------+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]