Last active
May 22, 2019 20:56
-
-
Save khalidr/dbff15b367b966889a9fbe4484452a10 to your computer and use it in GitHub Desktop.
Get an estimate of the number of bytes an object takes up on heap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def size[T <: AnyRef](obj:T) = org.apache.spark.util.SizeEstimator.estimate(obj) | |
val myObj = new MyObj() | |
println(s"object size is ${size(myObj)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment