Am Sonntag, 24. August 2008 23:12:18 schrieb Dennis Schridde: > Am Sonntag, 24. August 2008 22:55:48 schrieb Per Inge Mathisen: > > On Sun, Aug 24, 2008 at 5:42 PM, Giel van Schijndel <[EMAIL PROTECTED]> > > wrote: > > > * Change an ASSERT that checks calloc's return value into an if() > > > block (we can also run out of memory on non-debug builds...) > > > > I am also rather mystified by this. When we fail to allocate memory > > and do not handle it gently, the next thing that happens is inevitably > > a crash when the null pointer is accessed. There is no reason to > > ensure that a crash happens with a call to abort() - if we are not > > going to attempt recovery, we just need to ensure that something is > > written to the log in order to debug it. Adding a five line > > conditional to every memory allocation is rather pointless and just > > bloats the code. > > *Maybe* a real crash can corrupt something or is not always handled > correctly? > > Aside of that I think we could add a out-of-memory "handler", or some more > generic way of handling the most common errors. > Why? So we can inform the user in a nicer manner than "application X was > terminated in an unusual way". (Console output now, maybe error popup > windows later.) IRC-update, rather generic: - Program "defensively", which means try to recover from errors (i.e. out-of-memory situations). - Only assert there, not abort, so that a debug build will catch the error, but a release build can continue. - Only do explicit handling of "extreme" situations (like out-of-memory) in certain situations which are particularly vulnerable.
An example was: out-of-memory on map load -> present a popup box "sorry, could not load map because we ran out of memory" and return to mainmenu. Game start and map load were considered particularly interesting for such out-of-memory handling. --Devurandom
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev