Is it possible to check programatically how much memory takes some object (with the whole subtree in the JVM memory). I would like to say (from the java code)
'tell me how much memory in the current JVM takes the JPanel with the whole reference subtree when we assume that mentioned JPanel is the root of this tree'.
I wonder if I could this way compare how much memory take two JPanels (or JFrame or whatever), and which takes more - without analyzing the dump. And I wonder if the answer is 'yes' how precise would be this value.