On 04/01/2011 10:03 AM, WAROQUIERS Philippe wrote:
>>>   2. add a new kind of error in memcheck: "failed (re-)allocation".

>> I support such a warning the first time (each) for malloc and realloc.
>> For realloc because memcheck tries to increase the chances of 
>> such an error;
>> for malloc because of general cleanliness.
>> I'm wary of giving a warning every time: too much noise for 
>> good programs
>> which correctly check and recover, but that happen to run out of space.

> I understand the worry, but at least in my experience, I have not seen
> much programs which effectively go to an out of memory situation and
> then check and recover.

I'd say it's the other way around: most programs already check.
C++ implementations of 'new' and 'new[]' always check their results
from malloc(), and often those are the only calls to malloc except for
internal calls from libc itself, which of course checks.  Most non-small
projects already allocate indirectly, often using a symbol such as 'xmalloc'.
Calls to malloc from third-party libraries are covered by interposing
using LD_PRELOAD and RTLD_NEXT.  (I admit that effective _recovery_
from 0==malloc() is almost non-existent.)

-- 

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to