memory management - Where is object reference variable (inside a ) stored? -
Now I am learning JVM memory models. I have a question:
But one thing is clear, that is, array values, is not it? After the the Java Stack is stored in the static method where its variable are stored. At the end of the stack These four references mention four byte arrays stored on a heap. package com; Public Class Test Allocation {Private Static Final Ent _1 MB = 1204 * 1024; Public static zero main (string [] args) {testAllocation (); } Public static zero test ratio () {byte [] allocation 1, allocation 2, allocation 3, allocation 4; Allocation 1 = new byte [2 * _1 mb]; Allocation 2 = new byte [2 * _1 mb]; Allocation 3 = new byte [2 * _1 mb]; Allocation 4 = new byte [2 * _1 mb]; }} So, where is reference allocation 1, allocation 2 stored? Since testAllocation () is a stable method, therefore, the variable method fields inside this function? But Stack is said every time in a function, it is stored in push / pop operation. So, allocation1, allocation is stored in the heap testAllocation () ?
testAllocation () there will be four references (allocation1, allocation2, allocation3 and allocation4).
Comments
Post a Comment