Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Memory related query

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Memory related query

    Hi Folks,

    I have a class with the member methods are static(not member data).
    I have written this class to hold the utility methods for my application.But i have declared all the member methods are static.

    Can anyone please confirm me whether the memory (stack) gets allocated to functions as soon as i run my application or the memory will be allocated based on the normal function call.

    I wanted to know is this the write approach to code or not ?

    Thanks & Regards
    Divakara


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Memory related query

    Why do you think you need to know this? Are you having a problem with memory or performance? Premature optimization is the root of all evil.

    But to answer your question, the stack is not affected until you call a method. You can confirm this by calling Thread.currentThread().getStackTrace() or new Exception().printStackTrace().
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Query on jtable and ireport
    By Samrudhi in forum Member Introductions
    Replies: 0
    Last Post: April 20th, 2011, 04:38 AM
  2. update query is firing first then insert query
    By salmondavid88 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2011, 10:15 AM
  3. Query
    By amol_kale in forum JDBC & Databases
    Replies: 0
    Last Post: February 18th, 2011, 07:04 AM
  4. SQL query not working
    By mjpam in forum What's Wrong With My Code?
    Replies: 11
    Last Post: September 28th, 2010, 05:15 PM
  5. Memory Handling -de allocate memory in Java
    By 19world in forum Java Theory & Questions
    Replies: 4
    Last Post: June 15th, 2010, 04:05 AM