I am creating and passing objects from one actor to another. I need to calculate the memory that is used to create an object at run time ?? Is there a way of doing it?
I am trying to do something like this .
var x = Runtime.getRuntime().totalmemory()
object.create() // my function to create an instance of an object
var y = Runtime.getRuntime().freememory()
val memoryUsedForCreatingObject = x - y
Do you think this is the correct way of doing it?? Will it give me the correct result?? Please let me know
Your best bet is probably JAMM: https://github.com/jbellis/jamm/