-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
(sorry the example is in Scala)
scala> case class Person(name: String, surname: String)
defined class Person
scala> objectexplorer.MemoryMeasurer.measureBytes(Person("", ""))
res1: Long = 64
scala> objectexplorer.MemoryMeasurer.measureBytes(Person("h", ""))
res2: Long = 112
scala> objectexplorer.MemoryMeasurer.measureBytes(Person("h", "h"))
res3: Long = 72
In the first line I declare a class with two properties. In the second I measure the size of an object of that class that is instantiated with 2 empty strings. In the third, an object with 1 character string and empty string. The size is indeed larger. Now I try with an object of two such strings. The size becomes less?
Metadata
Metadata
Assignees
Labels
No labels