Howdy,

I'm trying to check for leaks in a program I've written, using "valgrind
--leak-check=full ...".  When my program stays within relatively small
memory usage, that is, less than 2G total, valgrind has no complaints.
 However, one of my test cases involves my program allocating a total of
about 16G with about 12.6G in a single block.  In this case, valgrind gives
me this warning, repeatedly (maybe a dozen times):
    ==31171== Warning: set address range perms: large range [0x13dde030,
0x31382050) (noaccess)
Then  complains about a dozen times about "Invalid write of size 1" in
memcpy called by fread, as well as one other complaint, "Syscall param
read(buf) points to unaddressable byte(s)", also in something called by
fread.  After this it tells me it has detected more than 10 million errors
and tells me to "Go fix [my] program!".  Then after reporting a page or so
of stats, I get a segfault.

The program doesn't segfault on this case when built without without
valgrind, and to the extent that I can tell, is giving me the correct result
(when valgrind isn't used).

The machine I'm running on is a 64-bit linux machine with 32G of RAM.  This
occurred with valgrind version 3.5.0 and also with version 3.6.1.

I have attempted to find info on how to "set address range perms", but the
best I have been able to find so far is that this is a message intended for
valgrind developers, not users.  Is this something I can change if I build
the valgrind source code?

*So... my question is, should I expect valgrind to work correctly in such an
environment?*  Or, equivalently, what are valgrind's memory limitations?

Also worth noting, possibly, is that the single 12.6G block is the result of
several reallocs. Since the target program does not know a priori how large
this needs to be, it grows the block on an as-needed basis.  I believe
valgrind is reporting a "set address range perms" message ever time realloc
runs out of space in the current block.  The first report has
    large range [0x13dde030, 0x31382050)
and the final one has
    large range [0x68c353030, 0x72a7c3050)
But if that last one is indeed the memory allocated for my huge block, it is
only 2.7G.

I'm trying to decide whether I truly have a problem in my program, or if the
problem that valgrind doesn't handle blocks of this size.

Thanks for any help,
Bob H
------------------------------------------------------------------------------
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
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to