Relative Content

Tag Archive for javakotlinruntimeheap

Java/Kotlin Heap Size

I’m trying to understand the space classes take up in memory in the heap when initialized, but I can’t find definitive information on this, so my question is given these 3 examples, what would be the order of size taken up by each class?
I know every int takes up a space of 4 bytes, but does not declaring it as a val or var alter this as in class C? Does having a getter method also alter it as in class A?