YourKit. The saved size of the object is not equal to the saved size of all the objects to which it refers

The saved size of the object is not equal to the saved size of all objects transferred to it.

Here's what happens:

  • Use YourKit to capture snapshot memory.
  • click an object and show instances by class type
  • suppose the stored instance memory is A bytes (600mb)
  • expand and summarize the saved size for the base instances, suppose the sum is B (300mb)

A → B

+4
source share
1 answer

Let me give you an example.

, , . :

- , , , . , , , .

, . Obj1 Obj1, Obj2 Obj3 - : simple case

. Obj6 Obj5, Obj5 Obj2. , Obj2 Obj4 Obj5. the saved size Obj1 is not the sum of Obj2 and Obj3 Obj1 . Obj1, 41. , Obj2, Obj5, - Obj6.

+2

Source: https://habr.com/ru/post/1542545/


All Articles