1

00:00:01,110  -->  00:00:07,290
Not look at some command line options that are related to heap memory on these options or passed the

2

00:00:07,290  -->  00:00:14,290
July interpreter while writing large programs you could very well encounter situations where you may

3

00:00:14,290  -->  00:00:18,400
run out of memory and you can get all out of memory errors.

4

00:00:18,420  -->  00:00:24,450
One reason could be you do creating too many objects on file that we can simply increase the heap size

5

00:00:24,460  -->  00:00:25,250
.

6

00:00:25,770  -->  00:00:33,230
But there can also be memory leaks Yes some memory leaks can still be that Angela despite all the hard

7

00:00:33,230  -->  00:00:35,330
work that GC does.

8

00:00:35,460  -->  00:00:38,740
We will soon see how memory leak is possible in Java.

9

00:00:39,240  -->  00:00:42,960
But for now let's see how we can add just a heap size.

10

00:00:43,110  -->  00:00:45,590
We are command line options.

11

00:00:45,850  -->  00:00:53,330
Howard in the simple program called GC them all and it declares an end date which is a static variable

12

00:00:54,000  -->  00:00:56,240
and it has on a million entries.

13

00:00:56,440  -->  00:00:56,810
OK.

14

00:00:56,860  -->  00:01:00,240
And each entries and which is basically 4 bytes.

15

00:01:00,390  -->  00:01:06,280
So if you multiply that so you would get around eight point four megabytes of data.

16

00:01:06,300  -->  00:01:07,520
So this data structure.

17

00:01:07,560  -->  00:01:10,460
It's the size of it would be eight point four megabytes.

18

00:01:10,680  -->  00:01:13,330
So it's going to go ahead and run it.

19

00:01:13,380  -->  00:01:18,800
But let's go into the run configurations and past the options that we want to pass.

20

00:01:19,020  -->  00:01:20,620
So let's go into arguments here.

21

00:01:20,800  -->  00:01:25,050
And so these are your arguments and you would pass the options here.

22

00:01:25,110  -->  00:01:29,850
So there are some options here which I have already included under do important things that we need

23

00:01:29,850  -->  00:01:33,340
to note here as x and x and x and x.

24

00:01:33,360  -->  00:01:36,090
So those are heap related options.

25

00:01:36,220  -->  00:01:42,630
X is the minimum amount of memory that would be a look at it to heap memory on that is 30 megabytes

26

00:01:42,630  -->  00:01:44,300
is what I'm passing on.

27

00:01:44,330  -->  00:01:46,800
X X would be the max.

28

00:01:46,800  -->  00:01:50,390
Max amount of memory that would be a look at it here.

29

00:01:50,640  -->  00:01:56,820
And right now it's both of them are 13 and B and if you change it to G here in sort of that would be

30

00:01:56,820  -->  00:02:00,810
gigabytes on it for display it would be kilobytes of data on print.

31

00:02:00,810  -->  00:02:05,140
GC dense is basically we want to print the gcd details.

32

00:02:05,160  -->  00:02:06,480
So it's like GC logging.

33

00:02:06,480  -->  00:02:11,970
So when our GC happens garbage collection happens it would print all the details of the memory like

34

00:02:12,180  -->  00:02:14,640
the summary of the memory before GC and after.

35

00:02:14,640  -->  00:02:21,440
GC OK so the memory the summary of the heap memory and we are forcing the GBM to use serial GCs serial

36

00:02:21,480  -->  00:02:22,100
collector.

37

00:02:22,220  -->  00:02:22,710
OK.

38

00:02:22,980  -->  00:02:27,290
So 39-B is good enough since our data is only 8.4 M-B.

39

00:02:27,300  -->  00:02:29,670
Now if you run it everything is fine.

40

00:02:29,670  -->  00:02:35,110
GC did not run yet because there are a sufficient amount of memory and it just did not trigger a GC

41

00:02:35,220  -->  00:02:35,530
.

42

00:02:35,800  -->  00:02:41,630
And but still it prints a summary of the heap memory and thats because of the print gcd does that would

43

00:02:41,820  -->  00:02:43,930
because of that option we have this.

44

00:02:44,130  -->  00:02:48,510
So its just printing some details about the young Mammootty So this is a memory information and there

45

00:02:48,510  -->  00:02:56,460
is Edan space from space to space and so on and so to look at it was this much for poor Temby and for

46

00:02:56,460  -->  00:02:57,920
the older generation.

47

00:02:58,440  -->  00:03:02,370
I don't mind them BS has been I look at it and there is also the model space.

48

00:03:02,430  -->  00:03:05,350
I'm using Java 8 so model space.

49

00:03:05,390  -->  00:03:10,830
So we have metalsmiths to store the metro area to test a class data and we know that it is Bardolph

50

00:03:10,830  -->  00:03:12,660
actually the need to memory.

51

00:03:12,720  -->  00:03:15,690
But that information is also getting printed here.

52

00:03:15,690  -->  00:03:23,140
Now let's just do something go back change the minimum memory to be here.

53

00:03:23,430  -->  00:03:27,270
So Maxxis does not see a blind run.

54

00:03:27,390  -->  00:03:29,620
Now you can see this new line here.

55

00:03:29,940  -->  00:03:36,270
So this is coming because initially GBM hired has only two M-B that's what we specified using the X

56

00:03:36,270  -->  00:03:37,600
M-S Frank.

57

00:03:37,860  -->  00:03:42,530
So with that it tried to look at space for this Adeyemi M-B and it free.

58

00:03:42,540  -->  00:03:45,060
So that's what this says location has value.

59

00:03:45,120  -->  00:03:48,330
And because of that GC has again iron.

60

00:03:48,330  -->  00:03:49,870
This is a four year GC cycle.

61

00:03:49,920  -->  00:03:55,650
So this is the information about this say something about young collection because a full GC would entail

62

00:03:56,100  -->  00:03:58,920
collection all collection and also metalsmiths collection.

63

00:03:58,920  -->  00:04:03,790
That's why you see Matt auspice yet at the very end here is for the oil collection.

64

00:04:04,000  -->  00:04:04,520
OK.

65

00:04:04,590  -->  00:04:11,650
So initially for the collection for the new generation there was around one maybe and I don't know seven

66

00:04:11,670  -->  00:04:15,060
sixty eight kilo bytes for all generations.

67

00:04:15,060  -->  00:04:17,050
So if you sum up it's around to M-B.

68

00:04:17,070  -->  00:04:24,420
So that's what has been a look at it initially and here it just says that before a young collection

69

00:04:24,420  -->  00:04:30,450
has been done this is the amount of memory that was used within one generation of 3:45 kilobytes.

70

00:04:30,750  -->  00:04:35,440
And after DC has been performing it you know it was using 128.

71

00:04:35,490  -->  00:04:37,470
So something has been freed here.

72

00:04:37,700  -->  00:04:45,620
And for the same thing for the op ed you're on so 1:46 and it increased OK before collection icles 1:46

73

00:04:45,630  -->  00:04:47,150
after collection it is 273.

74

00:04:47,160  -->  00:04:53,940
So maybe most likely something got passed got promoted from the end generation to the older generation

75

00:04:53,940  -->  00:04:54,060
.

76

00:04:54,060  -->  00:04:58,030
Unfought Let's see what it is for them or just miss them or just.

77

00:04:58,830  -->  00:05:03,160
2400 kilobytes before or after so nothing has changed here.

78

00:05:03,330  -->  00:05:05,630
So that's when we are just.

79

00:05:05,910  -->  00:05:12,390
Now let's just go back and let's change it.

80

00:05:12,450  -->  00:05:18,090
Change District 12 maybe and it should still work because we have our data is only eight point four

81

00:05:18,080  -->  00:05:19,310
on we to LMB.

82

00:05:19,530  -->  00:05:22,330
But to our surprise it free.

83

00:05:22,830  -->  00:05:28,140
And the reason for that is because if you see here for the younger generation the space available is

84

00:05:28,350  -->  00:05:35,640
around 3700 which is less than 8.4 and here eight point one and B has been allocated to older generation

85

00:05:35,640  -->  00:05:37,980
which is also an eight point four.

86

00:05:38,010  -->  00:05:44,250
So the thing it failed is because none after Regence had enough space to look at it all put together

87

00:05:44,250  -->  00:05:48,880
they had more than this but individually they did not have enough space.

88

00:05:48,960  -->  00:05:52,850
So that was a main reason for this failure on their Ronsard.

89

00:05:52,980  -->  00:05:54,050
See is happening here.

90

00:05:54,090  -->  00:05:58,700
So the first you see was just like it tried with two M-B space and it failed.

91

00:05:58,920  -->  00:06:02,300
Then it increased it to grow let me understand afraid.

92

00:06:02,410  -->  00:06:02,950
OK.

93

00:06:03,000  -->  00:06:08,550
So on both of them are full of uses but just that in the second Do you see for some reason it was doing

94

00:06:08,550  -->  00:06:10,320
it only on the order collection.

95

00:06:10,380  -->  00:06:10,810
Okay.

96

00:06:10,920  -->  00:06:16,140
So thats why you have this out-of-memory error on which is we are out of memory you do.

97

00:06:16,170  -->  00:06:19,350
There is not there isn't enough Jawa space.

98

00:06:19,500  -->  00:06:27,330
So only is out of this is to increase the heap memory back to 13 and we are maybe more than that but

99

00:06:27,330  -->  00:06:29,260
there is also one Hokke which we can do.

100

00:06:29,370  -->  00:06:34,830
And let me just so that we I don't think you would ever do this but what you can do is we can force

101

00:06:35,700  -->  00:06:44,740
me and disaffiliate here you can force GBM to restrict young generation size to be around 1 and be under-staffed

102

00:06:44,750  -->  00:06:47,210
it should be a look at it to or generation.

103

00:06:47,220  -->  00:06:50,050
Now if you do that we are fine.

104

00:06:50,190  -->  00:06:51,430
It works fine.

105

00:06:51,600  -->  00:06:56,730
And that's because for the generation that is I don't want M-B on for the old generation now it has

106

00:06:56,730  -->  00:06:57,970
around 9 M-B.

107

00:06:58,050  -->  00:07:00,210
So an item be sufficient to horded this.

108

00:07:00,330  -->  00:07:00,820
Okay.

109

00:07:00,870  -->  00:07:02,710
So just that's just for a hike.

110

00:07:02,890  -->  00:07:04,870
Just wanted to show that.

111

00:07:04,890  -->  00:07:06,030
So that's about it.

112

00:07:06,030  -->  00:07:13,410
So the main thing is the Exham as on the economics fracs and you might be using it in your professional

113

00:07:13,410  -->  00:07:14,610
life do.

114

00:07:14,890  -->  00:07:19,080
And there are many other flaks that we can use for example for model space.

115

00:07:19,080  -->  00:07:23,630
We can specify the size and there are some flak for that.

116

00:07:23,880  -->  00:07:29,820
I would try to include some additional pointers and also some additional notes in the resource section

117

00:07:29,820  -->  00:07:32,600
so you can look up there where our catering group.

118

00:07:32,670  -->  00:07:35,480
Some other Flack's that we can use.

119

00:07:35,580  -->  00:07:36,360
Okay.

120

00:07:36,360  -->  00:07:37,990
So that's the main thing.

121

00:07:38,310  -->  00:07:41,810
So that's how you can I just heap memory size.

122

00:07:42,030  -->  00:07:42,490
Okay.

123

00:07:42,570  -->  00:07:43,330
Thank you.
