memory management - Where is object reference variable (inside a ) stored? -


Now I am learning JVM memory models. I have a question:

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

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 testAllocation () there will be four references (allocation1, allocation2, allocation3 and allocation4).

These four references mention four byte arrays stored on a heap.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -