• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Methods memory allocation

 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I want to know the difference between the way that static and non-static methods are allocated memory.
Thanks....
 
Paul Clapham
Sheriff
Pie
Posts: 20719
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't a difference.
 
Winston Gutkowski
Bartender
Pie
Posts: 10087
55
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhanshu Mishra wrote:I want to know the difference between the way that static and non-static methods are allocated memory.

Why?

Winston
 
Siva Vulchi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no difference at all.

For each thread, there will be a stack that holds state of method invocations(or stack frames).The state of a Java method invocation includes its local variables, method arguments, its return value and intermediate calculations. While executing a particular method by a thread, it creates stack frame entry on to the stack and executes the code logic using pc registers. And size of stack frame for any method is decided at run time but does not depend on method type.

Siva

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic