On 04/01/2011 03:00 AM, Tom Hughes wrote:
> On 01/04/11 10:50, Julian Seward wrote:
>>
>> [... mucho discussion ...]
>>
>> I'm now comprehensively confused.  Is there any bug/failure in
>> Memcheck resulting from this, that needs to be looked at?
> 
> There is no clear evidence of one at the moment.
> 
> The current situation is that we have proved that the test program
> really did have a leak that was correctly reported. The only outstanding
> question there was about why memory allocation was failing under
> valgrind when it worked normally but that is expected.

There is a failure, at least from the user's perspective.  When run under
memcheck, then the [corrected] test program runs out of space much sooner
than expected.  The space overhead appears to be greater than 20 to 1,
when something like 3:1 might be "normal".  When the size of individual
blocks is huge (exceeds (RAM + SWAP)/400, for example) then the default
settings tend to exhaust space very quickly, with symptoms that are
mysterious to non-experts.  This is a Usability bug.

Bart Van Assche suggests --freelist-vol=0, which is an excellent suggestion.

For better usability, then memcheck should take more care with huge blocks.
Put a bound of (RAM + SWAP)/8 on the volume of the freelist; or, keep a
separate freelist for huge blocks, and age them faster.  For a growing
realloc() of a huge block, then relax the strategy which forces malloc_new +
copy + free_old.  Give up some local error detection for the chance to
live long enough to detect more errors later.

If nothing else, then when the first huge block is detected give a warning:
    huge block detected (%lu bytes); consider adjusting --freelist-vol


[The values of MemTotal and SwapTotal are in /proc/meminfo.  Evaluating
the threshold once is enough even though /sbin/swapon or pluggable RAM
might change it.  Disregarding other processes is OK because even novices
know to minimize external contention.]

-- 

------------------------------------------------------------------------------
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