[cfe-dev] Stack space consumption query

Dallman, John john.dallman at siemens.com
Fri Jan 13 10:36:49 PST 2012

Chris Lattner [mailto:clattner at apple.com]

> you might just check against a 3.x to see if it is doing better on
> your code.

Currently, the only way I have to check if I have enough stack space is
to run a suite of tests and see if they crash out. The stack sizes we
were using were based on doing that and rounding up. A way of monitoring
actual stack usage would be distinctly helpful, but I haven't been
getting very far with finding one today.

The nearest on Mac OS X that I can see - but haven't yet tried - is to
locate the individual tests (out of hundreds in a suite) that use the
most stack, modify the test harness to pause at them without tidying up,
and use vmmap -verbose to see how much stack is actually used. This is
rather clumsy, and since the code base is changing and new tests are
constantly being added, goes out-of-date quickly.

I can't find a monitoring tool that will tell me what the largest amount
of thread stack used by any thread in a process is; there are interactive
tools like vmmap, but they rely on you running them at just the right
time. I've worked out how to build a monitoring infrastructure to do the
job in my thread creation wrapper function, but it's rather hacky, and will
take me some time to implement.

Any suggestions welcomed - this appears to be a neglected area.

John Dallman

More information about the cfe-dev mailing list