So that's the end of that. 2
J.B. I'm in dentals chapter and Bonneau have a good understanding of the internal workings of the Jalla 3
platform. 4
Let's go ahead and review some of the main features we covered in this chapter. 5
We began this chapter by looking at the lifetime of a type. 6
We saw that a pipe goes through three stages from the time it is access for the very first time to the 7
time it is executed. 8
The three stages are loading linking and initialization learning is nothing but glassblowing and it 9
is performed by the classloader which is a GBM component. 10
When the glasses axis for the very first time the classloader searches for the dark classifier. 11
And once it is found it will lower the corresponding bite caught the memory and will also create a class 12
object for that particular class. 13
So the output of this stage is a class object which will be in the next stage which is linking linking 14
is a most complicated of the three stages and it involves three suffixes verification preparation and 15
optional resolution step verification ensures that the classloader is safe to be executed by JVM. 16
That is it ensures that it's not compiled by a malicious compiler next preparations don't create storage 17
for that use an initialization with default values. 18
Third step is resolution which is responsible for loading any grassers that the current class is accessing 19
to be more specific as the bermed resolution suggests it resolves any symbolic references by replacing 20
them with direct references. 21
Example references could be two classes or any fields or methods in those classes. 22
Also the resolution can be performed right after Operation step in which case it is called as early 23
loading or it can be delayed to a later time in which case it is called lazy loading. 24
Typically more DBMS implement lazy loading in which case classes are loaded only as they are and counted 25
during the program execution. 26
Finally we have the initialization stage in this stage. 27
Static fields that were earlier assigned default values during the preparation step will be done with 28
a user defined initial values. 29
Next we look at the reflection reflection allows programs to do two things. 30
One is it allows programs to introspect known or unknown code that would allow us to view Rockmart that 31
feels an constrictors are defined in a particular class on a particular object. 32
One example usage of this can be found in ideas like Eclipse which allow us to browse fields on methods 33
in a class or an interface. 34
Reflection also allows us to affect the runtime behavior. 35
For example if you just know the class name at runtime you will be able to load the class create an 36
instance of that class. 37
And even in metrics on that instance and even set or get values of fields of that instance if you'll 38
recall we discussed briefly about ambition processors and dynamic proxies both of these use reflection 39
to affect the runtime behavior. 40
Next we looked at the different runtime data areas that formed part of the Gibeah memory which is a 41
look at it but the underlying operating system one of the runtime data areas is heape which is where 42
all the objects are stored. 43
Even arrays and class objects get stored here. 44
Basically it is where we how all the instance data matter area is where we store plastic to between 45
grid Mad-Eye information about classes and also the actual method bytecode. 46
It would also include the runtime constant. 47
Well not that priority of Java aid method is part of permanent generation space but from Java 8 onwards 48
method is part of a news is called model space which is part of the of memory. 49
So there is not firm space anymore but metal Elyon heap are shared across all threads and other runtime 50
the diarrhea that we discussed in detail is a stock which holds information about the methods that are 51
currently being executed for each exit getting murdered. 52
We will have a corresponding stack frame on the stack. 53
Recall that if a local variable in the method is an object reference then that reference will be stored 54
on the stack frame itself. 55
But the actual object it is referring to will still be on the heap. 56
OK. 57
So just keep that in mind now as you can see here the GBM stack native stack and the program counter 58
are maintained at a partridge level. 59
Finally native heape is basically the total user space minus a Java heaps. 60
Ms. 61
How are some of the runtime data areas like the metro area the stacks under PC icon for some of the 62
space so near to memory is basically the leftover part that you can see here on the left corner of the 63
diagram. 64
Next we'll have that automatic memory management which is one of the main benefits of Java over a language 65
like C++. 66
It helps in avoiding memory corruption which can lead to issues like dangling references and memory 67
leaks. 68
It does this by restricting programmers from directly manipulating memory a process called Garbage collection 69
is used for this which reclaim space occupied by dead or abandoned objects. 70
Not that memory leaks are still possible in Java. 71
However I suggested an effective Daleiden memory leaks can be avoided by ensuring that there are no 72
obsolete object or Francis now when it comes to garbage collection there are two main challenges. 73
One is to do with identifying and reclaiming data objects. 74
What is garbage collectors employ mark and sweep kind of algorithms these algorithms would require pausing 75
the application completely. 76
And that leads to the second challenge which is how do we minimize such application pastimes to address 77
this garbage can APIs use generational collection approach which mainly focuses on newly created objects 78
and does not bother much about long living objects. 79
Certain garbage collectors use features like multi-threading to further reduce the pastimes. 80
Finally we look at few important bytecode instructions A-story instruction box data from the operand 81
stack and start it at a specified index in the local variables are it a lot instruction does the exact 82
opposite in what expression is used for invoking instance initialization methods private methods and 83
methods of a superclass. 84
We are the supercooled instance initialization methods are nothing but the constructors invoke virtual 85
is used for invoking instance methods. 86
No not that would invoke special and invoke virtual fusspot pop the top element on the operand stack 87
of the current method unstarted at zero. 88
And next in the local variables array of the Invoke method. 89
OK so just keep that in mind. 90
Another instruction is in static. 91
It was discussed well covering method binding and it is used for invoking static methods. 92
So that's about it. 93
I think that's a pretty solid tradeoff JVM. 94
It is more like a medium sized course on just JVM. 95
So congratulations for completing the chapter. 96
And thanks for listening and I will see you soon. 97
Until then happy coding