Answer the question
In order to leave comments, you need to log in
Are the fields of the object placed on the heap, or are its methods too?
Hello.
They say that objects are placed on the heap. Do you mean its fields or also methods?
That is, methods are created for each object, or do all objects of the same type refer to the same methods?
Answer the question
In order to leave comments, you need to log in
Method bytecode is in classes, classes are in metaspace, and metaspace is off-heap. Objects are normal C structures containing nothing but field values and a 16-byte concatenation for a header. You might be interested in this answer .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question