Marcelo Cantos
Marcelo Cantos

Reputation: 185862

How much stack do programs use?

Actually, I'm not expecting an answer to the specific question. I'm really wondering if there are any studies out there that might give some insight into usage patterns across the spectrum.

More precisely: Are there any published surveys on how much of the call stack programs typically use across different platforms, workloads, compilers, etc.?

EDIT: In response to some comments suggesting that the question is meaningless...

My own observations hint that stack utilisation follows something resembling an exponential distribution with a mean on the order of tens of bytes. I was hoping for some kind of indication of the stability of the mean along different dimensions. I.e., if I measured the stack consumption across a wide range of programs, would they exhibit a similar p.d.f., no matter how I group the results, or will, say, Linux programs consistently have bigger/smaller stacks, on average, than Windows programs, or statically-typed languages vs dynamically-typed languages, and so on?

Contrast this with, say, total RAM usage, which is influenced by the specifics of the problem at hand, in particular, the working set required by that program to efficiently carry out its duties. My hypothesis is that the distribution of stack utilisation will be relatively stable across a wide range of environments, and I simply want to know if that or a similar hypothesis has ever been confirmed or falsified.

(Note: I won't pretend that my observations are accurate, comprehensive or in any way scientific. That's why I'm here, asking the question.)

Upvotes: 1

Views: 79

Answers (1)

venkatKA
venkatKA

Reputation: 2399

I could interpret your question in a way. In Java, The default native stack size is 128k, with a minimum value of 1000 bytes. The default java stack size is 400k, with a minimum value of 1000 bytes. Of course you can extend the sizes using -ss and -oss parameters respectively.
More precisely : I don't understand your need for published surveys on stacks across platforms.

Upvotes: 1

Related Questions