1
Reply

Why References are stored on heap and variables on stack?

Marcus

Marcus

Jul 05, 2011
3.7k
0

    If we store reference type on stack they would live exactly as long as the method call where they are created. They could not be freed earlier and not survive after. Also the stack has a limited size (2 MB by default) and can not be expanded at run time.
    It reduces the performance of the application.

    Avinash Patil
    October 25, 2011
    1