|
From: Bart V. A. <bar...@gm...> - 2006-11-20 10:33:18
|
If I may ask a dumb question: the massif documentation ( http://www.valgrind.org/docs/manual/ms-manual.html) specifies that it is possible to obtain information about stack sizes with massif. Which command line options should I pass to massif in order to obtain information about the maximum number of bytes used on each thread's stack during a program's lifetime ? Note: I know that the current usage and the maximum allowed stack size can be obtained from /proc/*/stat and /proc/*/maps respectively, but this is not what I'm looking for. -- Regards, Bart Van Assche. |
|
From: Ravi S. <rav...@gm...> - 2007-05-09 15:13:06
|
Hi All, I am using valgrind for the first time and may be this is a silly question but would appreciate if someone can answer. My code is basically a scientific application which needs a lot of stack size. I set stack to unlimited using ulimit -s command. After this my program runs large cases just fine if run without valgrind. Before increasing the stack, the program used to segfault inside a subroutine. Running it with valgrind showed invalid read/writes at places which do not access any invalid location. The problem is that even after increasing the stack size, valgrind gives the same errors and the program segfaults at the same location as it used to when stack size was less. Is ulimit -s not applicable when running programs with valgrind? Thanks, Ravi |
|
From: Ashley P. <api...@co...> - 2007-05-10 16:02:10
|
On Wed, 2007-05-09 at 10:13 -0500, Ravi Sharma wrote: > Hi All, > I am using valgrind for the first time and may be this is a silly > question but would appreciate if someone can answer. > > My code is basically a scientific application which needs a lot of > stack size. I set stack to unlimited using ulimit -s command. After > this my program runs large cases just fine if run without valgrind. > > Before increasing the stack, the program used to segfault inside a > subroutine. Running it with valgrind showed invalid read/writes at > places which do not access any invalid location. > > The problem is that even after increasing the stack size, valgrind > gives the same errors and the program segfaults at the same location > as it used to when stack size was less. Is ulimit -s not applicable > when running programs with valgrind? This thread might be of help to you, there is a 16mb limit on stack size within valgrind and even below this it can get confused if you allocate large objects on the stack, have a look at the documentation for --max-stackframe=<size> http://thread.gmane.org/gmane.comp.debugging.valgrind/6375 Ashley, |
|
From: Bart V. A. <bar...@gm...> - 2006-11-20 12:14:59
|
By this time I found out that massif reports the total stack size used by all threads in a graph (.ps file). What I would like is the stack size used per thread, as a number. Is this possible with Valgrind ? On 11/20/06, Bart Van Assche <bar...@gm...> wrote: > > If I may ask a dumb question: the massif documentation ( > http://www.valgrind.org/docs/manual/ms-manual.html) specifies that it is > possible to obtain information about stack sizes with massif. Which command > line options should I pass to massif in order to obtain information about > the maximum number of bytes used on each thread's stack during a program's > lifetime ? > Note: I know that the current usage and the maximum allowed stack size can > be obtained from /proc/*/stat and /proc/*/maps respectively, but this is not > what I'm looking for. > |
|
From: Nicholas N. <nj...@cs...> - 2006-11-20 21:49:39
|
On Mon, 20 Nov 2006, Bart Van Assche wrote: > By this time I found out that massif reports the total stack size used by > all threads in a graph (.ps file). What I would like is the stack size used > per thread, as a number. Is this possible with Valgrind ? Maybe. You'd have to modify a tool/write a new one. You'll need to monitor stack size changes (use the new_mem_stack* and die_mem_stack* events). Stack switches are trickier, if the SP change is more than a certain amount (2MB by default) Valgrind assumes it's a stack switch and doesn't tell the tool with those events (see coregrind/m_stacks.c:VG_(unknown_SP_update)). We should really have an event for stack switches so tools can know they've happened... Nick |
|
From: Nicholas N. <nj...@cs...> - 2006-11-20 21:44:26
|
On Mon, 20 Nov 2006, Bart Van Assche wrote: > If I may ask a dumb question: the massif documentation ( > http://www.valgrind.org/docs/manual/ms-manual.html) specifies that it is > possible to obtain information about stack sizes with massif. Which command > line options should I pass to massif in order to obtain information about > the maximum number of bytes used on each thread's stack during a program's > lifetime ? Massif doesn't provide that information. At each census point it sums the size of all stacks and treats them as a single allocation. If they're in the top 20, you'll see them in the graph. Nick |