![]() To learn more, check out the following resources: Heap Space exists as long as the application runs and is larger than Stack, which is temporary, but faster.Stack is accessed through a last-in, first-out (LIFO) memory allocation system. Memory allocation in the Heap Space is accessed through a complex, young-generation, old-generation system.Primitive local variables are only accessed the Stack Memory blocks that contain their methods. Objects stored in the Heap can be accessed throughout the application.The Heap Space contains all objects are created, but Stack contains any reference to those objects.Java Heap Space is used throughout the application, but Stack is only used for the method - or methods - currently running.Because the program ends at this line, Java Runtime frees all the memory and ends the execution of the program. Finally, at line 9, main() method terminates, and the Stack memory created for it is destroyed. ![]() At line 8, foo() method is terminated, and the memory block allocated for it in the Stack is freed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |