Mike Hearn wrote:
On Fri, 21 Jan 2005 22:02:00 +0100, Michael Stefaniuc wrote:
Well, it should be pretty easy to write a short smatch script to find that occurences. Afair the smatch guys wrote one for the Linux kernel which would need only small adaptations.
OOM safety is a bit complicated, you have to properly unwind the stack and restore state as you go - for instance the last patch I submitted fixed a bug where OOM would not cause the loop to terminate, but I forgot to free some data as we returned up the stack.
Given that it can be quite complex and introduce new bugs, and given that it's really quite a useless feature IMHO as modern Linux boxes will hang themselves in swap hell before returning NULL from malloc I don't think this should be a janitorial project.
I thought more of checking the return value of HeapAlloc/HeapRealloc to make sure it's not NULL. This would be easy to do. What you proposed is too complicated.
bye michael