Hello Carsten,

Wednesday, December 16, 2009, 9:00:58 PM, you wrote:

>>> The first thing i had to learn was, that it is verry uncommon in
>>> OpenOCD to check the result of malloc.
>> This is a known problem where we gladly accept patches to fix each
>> case.

CB> OK, then i will start to fix all the mallocs
CB> that are handled not correct yet and where
CB> i understand what to do if they fail.

There is an emerging opinion that checking for malloc failures in
application code is counterproductive:
1) it is rarely tested properly, thus almost never works as expected
when allocation does fail
2) it bloats the code, in some case substantially, and obscures the
"real" code flow
3) it's very hard to write a proper rollback algorithm for all
situations
4) if the system is at the stage where malloc fails, there's little
guarantee that your recovery code will work properly
5) many systems just kill the process when the memory is exhausted
instead of returning NULL

http://article.gmane.org/gmane.comp.audio.jackit/19998
http://log.ometer.com/2008-02.html#4.2


-- 
WBR,
 Igor                            mailto:skochin...@mail.ru

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to