java - How JVM stores meta information of a class? -


we use reflection user defined class employee as:

employee e = new employee(); class c = e.getclass(); 

as per knowledge first jvm loads bytecode of class employee, create object of class.class each loaded class (class employee here). in object of class.class jvm stores meta information loaded class.

meta information of class "name of methods", "name of fields" etc. class of these types such "method", "field" etc defined in java.lang.reflect package.

i seen code of class.java. found methods in class.class returning objects or array of objects of these types such "method", "field" etc. there not field in class.class type "method", "field" etc.

if above statements wrong, please make me correct. if above statements not wrong have following doubts: 1). in field of class.class various information class stored? 2). in memory area of jvm object of employee , object of class.class stored? 3). in memory area of jvm bytecode of employee , bytecode of class.class stored?

in field of class.class various information class stored?

this information store off heap in permgen (< java 7) or metaspace (java 8+) can't see java directly.

in memory area of jvm object of employee , object of class.class stored?

all objects stored on heap. smaller objects created in eden space.

in memory area of jvm bytecode of employee , bytecode of class.class stored?

the byte code stored in permgen/metaspace, if stored @ all. in theory, though not in practice, jvm re-read class file required.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -