Re: stack size

"Dave Brosius" <[email protected]> Sun, 10 Sep 2006 23:44:05 -0400
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <000e01c6d554$8829fca0$6401a8c0@MeBigFatGuy>
In each class file, their is a code attribute associated with every method. 
In this code attribute is the max stack size used by that method.
Theoretically you could instrument your code using BCEL to add/subtract this 
value at the start/end of each method to a grand total per thread.

See
4.7.3 The Code Attribute

    Code_attribute {
    	u2 attribute_name_index;
    	u4 attribute_length;
    	u2 max_stack;
    	u2 max_locals;
    	u4 code_length;
    	u1 code[code_length];
    	u2 exception_table_length;
    	{    	u2 start_pc;
    	      	u2 end_pc;
    	      	u2  handler_pc;
    	      	u2  catch_type;
    	}	exception_table[exception_table_length];
    	u2 attributes_count;
    	attribute_info attributes[attributes_count];
    }

here

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#43817


----- Original Message ----- 
From: "Marc Van Daele" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 06, 2006 5:39 AM
Subject: stack size


> Hello,
>
> Sorry if this turns out to be off topic but I want to monitor the current 
> stack size of my Java Threads.
> I wonder whether this is possible with BCEL?
> Any other options?
>
> Marc
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>