This is an addendum to 4593133.
It would be prudent if getStackTrace() had a limit parameter for
the occasionaly use (see the example in 4593133 where only a few
frames are needed to discover a caller to a log/tracing function).
Comments
WORK AROUND
11-06-2004
SUGGESTED FIX
11-06-2004
PUBLIC COMMENTS
10-06-2004
EVALUATION
It's a reasonable request to allow specifying the maxinum number of
stack frames to be dumped in the stack trace.
###@###.### 2003-07-22
Given that the primary purpose of getStackTrace is to generate diagnostics, it's not clear to me why it's important to optimize it. I expect that the common case will be to get the entire stack trace. If it is worth adding a limited form of the call, it should be added in addition to the the unlimitied form, not as a replacement. But I'm wary of adding the limited form, as it might encourage people to abuse the call, e.g., to make security decisions based on the result. Barring a compelling performance argument, my natural inclination would be to stick with the unlimited form.
###@###.### 2003-07-22
I will close this as will not fix as the submitter agrees that
creating StackTraceElement for all frames is unlikely to be a performance
bottleneck. We will revisit this when more performance data is provided.
###@###.### 2003-08-18