• Post Reply Bookmark Topic Watch Topic
  • New Topic

Would it be possible to write a servlet that output the current stack size?

 
Guy Leeds
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As the title suggests, I would like to develop a servlet which could output the current stack size at fixed time intervals. Is this feasible? Can anyone give me any assistance?

Thanks,

GM
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't the current stack size be local to the current running thread (if it were accessible at all. I don't know that it is)?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stacks are on a per-Thread basis and thus will always be the same for a request.

With Tomcat, I use the Management application to keep an eye on memory use.

Bill
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt it. Although the popular conception of the stack is a linear area of memory that grows in one direction, a stack is actually a collection of frames that are linked together. It's efficient to acquire the memory for the next frame by augmenting a stack pointer, but there are other ways, and even in systems where a stack pointer is maintained thus, some implementations have been known to acquire a new chunk of frame storage from the heap when the existing frame chunk runs out of capacity.
 
Guy Leeds
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies. I'm at least getting a better understanding of how the stack(s) work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!