zhangyan
2008-12-13 09:07:41 UTC
I have used the valgrind for a long time,and recently I am writing a program
which will allocate a very large block of memory once a time,and The
valgrind will always report the warning "set address range perms: large
range <number>".
That's is really annoying.
The version of valgrind which I use is 3.3.0,and I have read the source code
of memcheck/mc_main.c this file,
that indicate if we allocate a memory more than 100MB once a time,the
valgrind will report this warning. So I want to know there is any reason why
100MB exactly???
And I guess the reason why set a threshold is that if I allocate too much
bytes as a block a time,the valgrind can't trace it exactly,even this block
of memory will be "definitely lost",the valgrind will report "possibly
lost".Is it correct???
I made this guess becauase recently I have done a experiement to test
valgrind's exactness,I allocate a specific number of bytes once a time,and
the program is like this
#define N 79814486
void foo()
{
char *a=(char*)malloc(N);
}
int main()
{
foo();
return 0;
}
And I thought the valgrind will report the error message of "definitely
lost",but when the N is more than or equal to 79814486,the valgrind will
report the error message of "possbily lost" instead of "definitely lost".
So I guess the reason why the developer set the 100MB is because if we
allocate too big
which will allocate a very large block of memory once a time,and The
valgrind will always report the warning "set address range perms: large
range <number>".
That's is really annoying.
The version of valgrind which I use is 3.3.0,and I have read the source code
of memcheck/mc_main.c this file,
that indicate if we allocate a memory more than 100MB once a time,the
valgrind will report this warning. So I want to know there is any reason why
100MB exactly???
And I guess the reason why set a threshold is that if I allocate too much
bytes as a block a time,the valgrind can't trace it exactly,even this block
of memory will be "definitely lost",the valgrind will report "possibly
lost".Is it correct???
I made this guess becauase recently I have done a experiement to test
valgrind's exactness,I allocate a specific number of bytes once a time,and
the program is like this
#define N 79814486
void foo()
{
char *a=(char*)malloc(N);
}
int main()
{
foo();
return 0;
}
And I thought the valgrind will report the error message of "definitely
lost",but when the N is more than or equal to 79814486,the valgrind will
report the error message of "possbily lost" instead of "definitely lost".
So I guess the reason why the developer set the 100MB is because if we
allocate too big