B ackground Last month I had asked a Java related question to all my students on a facebook post . Why is it that in Java, Objects are always to be allocated on heap? Why is dynamic allocation the only option in the toolbox of a Java developer while creating objects? It was a very interesting discussion on facebook. Many participants, my students and otherwise gave good arguments in defense of the Java Language Design. One of the arguments that came out shining, was that of the possibility of unsafe allocations on Stack Frame. Special thanks to Ted Lum, Chetan Parmar, Nishant Verma, Vaibhav Desai, Tusharkumar Thomar, Vimal Sakhiya, Clair Roma Henry, Subham Gadi, Makarand Bhosle, Prasad Kowli and Nirav Kothari for their participation and valuable arguments. Let me now, put forward my perception on why Java Language Designers would have taken such a decision. The following content in this article assumes that the reader is aware of memory models and lif...
Comments