-
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
-
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().