1

00:00:01,170  -->  00:00:07,220
Now let's look at the specifics of runtime Byerly us and let's start with the method area under a heap

2

00:00:07,220  -->  00:00:07,950
.

3

00:00:08,340  -->  00:00:15,000
We will look at what goes into that area and also how heap and method area are interconnected.

4

00:00:15,990  -->  00:00:23,670
Let's see how things get populated on heap and area we know the objects are created on heap on these

5

00:00:23,670  -->  00:00:31,380
objects which include regular class instances that are created via a new operator Arrius are not class

6

00:00:31,380  -->  00:00:35,160
objects when we say objects are stored on the heap.

7

00:00:35,160  -->  00:00:37,080
What does that mean.

8

00:00:37,110  -->  00:00:43,450
It means that we are mainly talking about the instance data present within those objects that is instance

9

00:00:43,540  -->  00:00:45,920
literally sites on the heap.

10

00:00:46,050  -->  00:00:53,340
So we have literally a look at space to an object based on how much of the instance it contains which

11

00:00:53,340  -->  00:00:59,220
is based on the number of incidents variables and also Data Types of those instance variables.

12

00:00:59,730  -->  00:01:04,250
No objects also can be in behavior which is nothing but methods.

13

00:01:04,410  -->  00:01:09,850
The method however is something that is specific to the class or not to the object.

14

00:01:10,290  -->  00:01:16,500
So that would be the last data and any class data will be stored in the metal area.

15

00:01:16,730  -->  00:01:18,290
So that area is very strong.

16

00:01:18,300  -->  00:01:24,390
Class data which is not limited to just method code but would also include Mad-Eye information like

17

00:01:24,390  -->  00:01:31,790
the feeling team freetime on other stuff that people will see something that is all about classes while

18

00:01:31,830  -->  00:01:34,760
heap is all about objects.

19

00:01:34,810  -->  00:01:40,440
Non-X if we want to create an instance of a class in this because there are few things that can happen

20

00:01:40,460  -->  00:01:41,160
.

21

00:01:41,680  -->  00:01:47,340
First classloader checks of the class object for that particular class is already there on the heap

22

00:01:47,340  -->  00:01:48,930
.

23

00:01:48,930  -->  00:01:55,170
If it is not there it would then create a class object on the heap and the corresponding class data

24

00:01:55,170  -->  00:02:02,640
itself in the method area and then JVM would also create a new instance of that class and store it on

25

00:02:02,640  -->  00:02:04,230
the heap.

26

00:02:04,230  -->  00:02:10,890
Now if a new object of the same class is to be created then only the object will be created and stored

27

00:02:10,890  -->  00:02:12,110
on the heap.

28

00:02:12,450  -->  00:02:17,910
Classloader knows that the class object and class data have already been created and so it does not

29

00:02:17,910  -->  00:02:19,210
create them once again.

30

00:02:19,470  -->  00:02:21,680
And we already know this.

31

00:02:22,140  -->  00:02:28,430
Similarly as a program continues to exist even how most of getting creator on board heap on Methody

32

00:02:28,430  -->  00:02:33,930
idea we can also see pointers going back and forth between heap and Methody.

33

00:02:34,320  -->  00:02:37,480
On one of them is a byte original point or two.

34

00:02:37,510  -->  00:02:45,240
Will see how this point will be useful not it's focus only on metadata and let's see what gets stored

35

00:02:45,240  -->  00:02:50,180
in it that it's what gets stored as part of the class data.

36

00:02:50,190  -->  00:02:53,920
What we will see here are general things that would be part of class data.

37

00:02:54,330  -->  00:03:01,330
The exact implementation details are GBM specific classes they don't include Medine permission of the

38

00:03:01,360  -->  00:03:07,620
type like fully qualified name of their type fully qualified name off its direct superclass fully qualified

39

00:03:07,620  -->  00:03:12,360
name of any direct super interfaces whether that type is a class or interface.

40

00:03:12,720  -->  00:03:20,030
And information about pipes modifiers like abstract final under access modifier public.

41

00:03:20,040  -->  00:03:23,990
We know that such information is accessible through class object.

42

00:03:24,150  -->  00:03:30,220
So what it means is that class object in dentally uses the class data which is stored in the metro area

43

00:03:30,250  -->  00:03:30,810
.

44

00:03:31,380  -->  00:03:36,240
So in the previous slide that was the reason why there was a connection from the class object to the

45

00:03:36,240  -->  00:03:41,000
class data but the connection was by that action.

46

00:03:41,190  -->  00:03:47,910
And that's because Glassner includes a reference back to the class object and this reference is needed

47

00:03:48,150  -->  00:03:50,900
whenever access to class object is needed.

48

00:03:51,450  -->  00:03:57,390
For example during class throating process classloader Fosdick's a class object for that pipe is already

49

00:03:57,390  -->  00:03:58,530
on heap.

50

00:03:58,770  -->  00:04:05,280
For that it may actually Serj the method area Boosey of the class data for the pipe exists and if it

51

00:04:05,280  -->  00:04:11,250
doesn't exist it would then simply return the reference to the class object.

52

00:04:11,400  -->  00:04:17,640
We know that classes in group feet like static and instance variables so Klausner don't include field

53

00:04:17,640  -->  00:04:27,120
information like free name free type and any associated modifiers like static Feiner any access modifiers

54

00:04:27,540  -->  00:04:28,260
under modifiers.

55

00:04:28,260  -->  00:04:29,810
Volatile and transparent.

56

00:04:30,090  -->  00:04:35,130
Whether it is related to multi-threading while consumed is related to serialization which isn't either

57

00:04:35,150  -->  00:04:39,590
related topic well then intransient will be discussed later.

58

00:04:39,590  -->  00:04:45,600
Note that here we are talking about free Mad-Eye information not the file happens to be an instance

59

00:04:45,600  -->  00:04:51,170
variable with the parameter data type then the value itself will be stored on the heap.

60

00:04:51,480  -->  00:04:56,790
But if the field happens to be a static variable with a primitive build up then the value will be stored

61

00:04:56,790  -->  00:04:58,670
in the metro area itself.

62

00:04:59,280  -->  00:05:06,630
Now if a field regardless of whether it is instance or static reference is an object then the object

63

00:05:06,630  -->  00:05:10,740
will be on heap as data placed off objects.

64

00:05:10,740  -->  00:05:16,740
But the reference itself which is the memory address of the object will be stored in the metro area

65

00:05:16,890  -->  00:05:18,900
in case of static variables.

66

00:05:19,230  -->  00:05:25,140
And I would strongly assume that the reference would be stored on a heap for instance variables as any

67

00:05:25,140  -->  00:05:32,810
instance where you would go on the heap closeted I would also include runtime constant put me under

68

00:05:32,830  -->  00:05:38,770
to discuss the dot classifiers would include something called constant pull on runtime constant it is

69

00:05:38,770  -->  00:05:41,890
simply at runtime version of that constant pool.

70

00:05:42,400  -->  00:05:48,070
It would basically include constants likely gross that is string literals are literally assigned to

71

00:05:48,070  -->  00:05:49,950
primitive variables.

72

00:05:50,260  -->  00:05:55,750
Constants can also include symbolic references which were discussed earlier in the lifetime of a type

73

00:05:56,140  -->  00:06:03,550
while discussing the resolution strip classes also include methods subclass data.

74

00:06:03,550  -->  00:06:10,300
I would also include method information like the method name methods Rikan type Nemeroff method parameters

75

00:06:10,630  -->  00:06:14,750
and also type off those parameters with the arder maintain.

76

00:06:15,460  -->  00:06:23,780
We know that methods can have modifiers too like static final access modifiers abstract synchronized

77

00:06:23,780  -->  00:06:30,410
or native Glassner can include all this method modifier ARFs synchronize is related to multithreading

78

00:06:31,000  -->  00:06:35,160
while native as the name implies would imply a native method.

79

00:06:35,560  -->  00:06:41,150
Which would mean that the method itself will be implemented in some other programming language method

80

00:06:41,250  -->  00:06:47,020
information will also include the actual code corresponding to the method body.

81

00:06:47,680  -->  00:06:48,340
Next Klausner.

82

00:06:48,340  -->  00:06:55,560
I will also include metor table which is simply an audio for references to instance methods.

83

00:06:55,570  -->  00:07:02,170
Note that we are talking about instance methods here are not static methods so each reference is basically

84

00:07:02,170  -->  00:07:09,460
a pointer to actual method bytecode itself which is also part of Gloucester to this table would be used

85

00:07:09,550  -->  00:07:12,100
during method in location process.

86

00:07:12,100  -->  00:07:17,200
That is when an instance method is invoked on an object then the method table would be used to find

87

00:07:17,200  -->  00:07:20,290
the method that needs to be executed.

88

00:07:20,290  -->  00:07:25,930
This is one reason for having a pointer from object on the heap with the class data.

89

00:07:25,930  -->  00:07:32,200
So in invoking a method on an object JVM would simply follow the pointer fremd the object to the class

90

00:07:32,200  -->  00:07:39,410
data and would then use the method table to find an exit to the target method and not admit that it

91

00:07:39,410  -->  00:07:45,780
would also include references to any methods inherited from superclasses in the next lesson.

92

00:07:45,800  -->  00:07:48,180
We will look at a very interesting example.

93

00:07:48,260  -->  00:07:50,870
Very we'll see how their table will be useful.

94

00:07:51,400  -->  00:07:57,280
So those are some of the things stored in the method area at the class level.

95

00:07:57,520  -->  00:08:04,660
No one thing to note about method area is that prior to Djala 8 method area was located in the so called

96

00:08:04,980  -->  00:08:08,650
permanent generation space are simply Bohmian.

97

00:08:08,650  -->  00:08:09,630
Angela ate.

98

00:08:09,640  -->  00:08:15,550
This area has been completely removed and the method area has been moved to near a heap and is not referred

99

00:08:15,550  -->  00:08:17,360
to as model space.

100

00:08:17,440  -->  00:08:18,970
So what was imagined then.

101

00:08:18,970  -->  00:08:21,510
Now is Matt auspice the problem.

102

00:08:21,500  -->  00:08:26,750
Namely does matter space because Metromedia and groats Mad-Eye information.

103

00:08:26,830  -->  00:08:34,360
One reason for this change is because for bombon there was a default maximum size set of the max size

104

00:08:34,360  -->  00:08:39,790
was reached and out of memory or would be generated with medals space.

105

00:08:39,880  -->  00:08:44,750
There is not before max size that is system memory is the limit.

106

00:08:44,770  -->  00:08:50,820
So you may not see order of memory error or even if you see it it may be delayed.

107

00:08:50,830  -->  00:08:56,500
Another reason is related to improving the both foments of garbage collection process.

108

00:08:57,160  -->  00:09:03,520
Earlier when discussing method tables we saw how JVM use method be able to invoke an instance method

109

00:09:04,660  -->  00:09:05,840
that is at runtime.

110

00:09:05,920  -->  00:09:12,700
The class due information associated with the type of the object has been used such type information

111

00:09:12,700  -->  00:09:20,010
used at runtime is referred to as runtime type information or RTTY in shock.

112

00:09:20,700  -->  00:09:24,770
RTD is also used to check the correctness of cost.

113

00:09:25,150  -->  00:09:31,870
For example here an object of type subclass is assigned to a variable whose reference type is superclass

114

00:09:32,910  -->  00:09:34,180
in the next statement.

115

00:09:34,210  -->  00:09:41,380
A typecast is inserted to assign the same object to a variable whose reference type is of type subgraphs

116

00:09:41,380  -->  00:09:42,340
.

117

00:09:42,340  -->  00:09:46,470
Whether this is a valid cost or not is performed only at runtime.

118

00:09:46,670  -->  00:09:52,900
On For that the class data of the object is consulted and run by so runtime type information is being

119

00:09:52,900  -->  00:09:55,550
used here.

120

00:09:55,780  -->  00:10:00,000
Arkadi is also used well-performing instance of operation.

121

00:10:00,550  -->  00:10:06,790
For example here at runtime it needs to be checked whether or not the object type of the reference variable

122

00:10:06,940  -->  00:10:11,570
is the class subclass so class state of the object is used here.

123

00:10:12,100  -->  00:10:16,630
So these are a few places where type information is utilized on time.

124

00:10:16,990  -->  00:10:22,690
So we have seen what constitutes method area and we have also seen how metatheory are a heap are interconnected

125

00:10:22,820  -->  00:10:23,220
.

126

00:10:23,760  -->  00:10:27,190
BLUEJACKET the resources section for some interesting pointers.

127

00:10:27,400  -->  00:10:33,350
One of the pointer is a chapter from the book Inside the Java Virtual Machine by build winners.

128

00:10:33,460  -->  00:10:39,220
Lots of material for the JVM stuff you're covering here comes from this book and all of it is available

129

00:10:39,230  -->  00:10:44,530
online and the link posted in the resources section is a reference to the online version of the book

130

00:10:45,370  -->  00:10:46,970
so you can take a look at that.

131

00:10:47,350  -->  00:10:49,150
And that's about it for now.
