File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Methods memory allocation

 
Sudhanshu Mishra
Ranch Hand
Posts: 235
1
Eclipse IDE Fedora Java
  • 0
  • 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: 20171
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't a difference.
 
Winston Gutkowski
Bartender
Pie
Posts: 9461
49
Eclipse IDE Hibernate Ubuntu
  • 0
  • 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
  • 0
  • 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

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic