Hi there. 2
Now let's look at runtime data areas which is nothing but a memory that is associated with JVM getting 3
a good understanding of this topic is very important for performance tuning as well as to handle memory 4
related errors like out of memory errors because the names are just happen when you run out of memory 5
any process when it starts up gets a chunk of memory from the underlying operating system. 6
This memory is referred to as Nathu memory. 7
The process will also have its own virtual address space which maps to physical memory or any file or 8
any addressable storage this virtual or dismiss will have two parts user space and corner space kernel 9
space is where the kernel resides. 10
And this base is shared by all the processes. 11
Hello to the user base is unique to each process. 12
And that's basically the native memory too. 13
And that's where the user programs are stored on a 32 bit Windows machine. 14
By default the process gets to G-B of userspace and G-B of kernel space. 15
Whereas on a 32 bit Linux machine by default it would be 3G by userspace and 1G be canon space in case 16
you're not familiar with concepts like we're toilet does space which is related to what you memory then 17
I would strongly recommend reading the book operating system concepts but Silber shots. 18
Not a good one or more really good pointers in the resources section and you can take a look at them 19
do not come into JVM as JVM is also a process. 20
It also gets its share of knaidel memory which it splits into multiple sub areas for storing different 21
things. 22
Here's an illustration of GBM architecture which we have seen at the beginning of the chapter. 23
As you can see at the top we have different sub areas within DBMSs memory which is nothing but the userspace 24
associated with JVM. 25
So these are the different runtime data areas off JVM. 26
Non-death briefly look at what these areas are and later we will discuss each of them in detail. 27
So here you can see only the memory area of the JVM architecture. 28
I just added one additional box for Naidu heap. 29
And I also rename heap to Jahi just to make it more clear and distinguish it from Naidu heap. 30
Although we have only a small box on native heape to be more precise Naboo heap is actually the total 31
userspace area minus the Jahi. 32
Hello Dallas blitz this nigga area in several other areas as we can see here. 33
So whatever is remaining is generally referred to as Nathu he ordinated memory. 34
Other terms like CPP or Mullarkey are also used for native here. 35
No we already know what a heap are Java heap is. 36
It basically stores Djala objects which would also include race and class objects. 37
We know the class can create class objects and we also know that even be developers can create class 38
objects as we saw on reflection setting a proper Java heap size is very important for good performance 39
on production systems. 40
Later when me look at Java heap we will also look at couple of Flack's specific to setting up Joe a 41
heap size. 42
Next Mediterranea contents class data which would be all the data up but end into a class dappling good 43
Mad-Eye information of the class like the fully qualified class name super class name and so on which 44
we could get using class object method. 45
I would also include the actual bytecode of each method and there are a few other things that would 46
be part of Metro area and we will look at them later. 47
Basically for every object on the heap we have it's corresponding class data in the method area. 48
Multiple objects of the same class will point to the same class data. 49
Just know that both methods area and heape are shared across all the threads. 50
We know that Djala can multitask by running multiple threads at the same time. 51
So if you have multiple threads then all of them will share the same method area and the same heap. 52
But as you can see there are certain things specific to each thread. 53
One of them is stack which is very important. 54
It is a good method in location's date. 55
That is the order of invocation of methods. 56
It would in good information about local variables within each method in one of the follow up lessons 57
we would like to look at stock and didn't like stack. 58
There is also a separate stack. 59
Just need two methods. 60
So what would it cost with a GBM stack on this stack specifically specific two methods. 61
Sometimes Delap programs might in work metters a native code which could be applications that are done 62
in native compiler languages such as C and C++ JVM itself relies heavily on native code to do stuff 63
like file and network input output. 64
Then there is program pointer. 65
It is Ignoto instructor pointer in native Scipio's it would hold the memory address of the next instruction 66
. 67
What that means is it is simply a pointer to a memory address in the method area as method areas where 68
we have the real method called. 69
That is a method by course. 70
So all these three Jalla stack natives stack and B C are maintained for each thread. 71
Finally the left already has a native heap and it can include stuff like code that is compiled by just 72
in time compiler. 73
Recall that the compiler compiles frequently use bytecode into machine code and stores them for future 74
use for faster performance so that code is stored here on the native heap Naidu memory can also have 75
a special kind of objects called Direct buffers which can be very useful when you want to cache lots 76
of data so that's a high level overview of the different runtime data areas in the user space of JVM 77
. 78
Next we will discuss some of these areas and didn't specifically will discuss about matter area Java 79
heap on the Java stack. 80
Did it before. 81
We will most likely go in the chapter. 82
We will also be coding garbage collector which is the compering that is responsible for automatic memory 83
management and that's about it. 84
With a high level overview of JVM memory