low values are over here the lower dresses in the high dresses are over here for something else called the stack like we just reported so let me stop having to keep kind of take over the whole board this tax starts off in the very highest dresses so here is the stack it starts off in a place like after after af right somewhere really with a really large value pretty dress and at that allocates more memory it grows upward which means the addresses get smaller and you might look at the diagram and say hey mera did i ever meet and they do sometimes and if they do it's real so if you're cheap and your stack ever overlap they start writing over each other and do you know what happens your machine just crashes but that's why you got so much memory the their joint all i've got to get a memory acai berries eight billion data addresses between the heap and miss that usually not actually have much of the program make from a little bit closer together but you got so much space in the richest right and you could probably use it in your program right by having some loop this delicate open to memory but really the thing you want to keep in mind is that these things at least for the programs that from most programs that you will have a right you never have to worry about we keep in the sack actually coming together the one i think that's associated with local variables parameters and dynamic variables mostly actually with any internet variables is how much space gets set aside for sap right now it's one thing you want to think about is different kinds of variables actually have different amount of space associate with them say something like in teenager elegantly stand java is four bytes this is not something you actually need to worry about it because it turns out on different machines they mate may actually be implemented in slightly different ways a character using a special kind of encoding were most characters are actually in two bytes sometimes if you get into some very funky languages that have lots and lots of characters are the way that special in coding for character is the unit code in coding is actually set up sometimes you can actually be as large as poor blacks so as far as you're concerned you don't really care about the underlying numbers it's an extraction q and that's the key information right even evil things like a teenager or a car is just hiding information it's hiding of the fact that it's a bunch of one zero degrees but you don't need to worry about it or how big it is all you need to know is how to use it along with that with dynamic variable there's also a little bit of overhead in their mind and it says that extra mana memory decides how much space is taken up by like you're in new jersey ur cars or whatever variables are inside your heart jack to keep track of other information about the object of how much information is actually kept track of about overheads not important but it's just important that you actually knows if their smoke decisively putting all this stuff together it turns out that we can look at the mechanics of what actually happens underneath the hood when you're on your program and create new objects right so if we go to the slides for second let's actually see sort of diaper matically what's going on when we actually create new objects and declare a variable so what we're going to have a some class called a point and this is a super simple flat all died as you can create a point with the constructor by saying here's a x and y location all it's going to do is store next live location for you and let you move more around right it's real simple it something you can imagine might be you know convenient to have when you're doing graphics safe passage necks in a wide sets its own internal instance variables piak simply why which i'd is called px if you like hermit remind us that there are a private accent private life there inside this particular class and then there's another method called a move that you pass it some offset in the x_ y_ location and it just changes it's private axelrod by whatever ops get a fairly straightforward should be you know pretty easy to understand given all the stuff you've done with graphic so far and then you can say okay you have this class haven't done anything with the class yet right we've just said hey i have this class no memories been allocated nothing's actually been done what you're going to have been some program somewhere like my program that's going to come along and create new point and call method on those point and we want to understand what's actually going on the computer in every wednesday sad or unhappy with the point class i'm going to make it disappear into second can you remember what it does there's two methods there's the constructor and the move and then there's two private variables jackson wine so let's see what happens when your programs actually running just a little unlikely have to keep in this that keep is going to go down stack is going to grow up just a can see that as we go along and the first thing we're going to do is our method to run gets called right when your program for start up the method ryan gets called what happens when a method gets call well when america gets called we create all the local variables and parameters rhonda has no plan later so we don't need set aside in space for parameters it does have to local variables p one ng p two so space noticed the synthesis starting at the very bottom of memory like f f f f there some overhead for the fact that we create a method not just sort of lock that often called overhead just match are the same style of the book that in and then there's some space some number of item in this case i just said four bytes they get set aside for p wanting some number of bikes they get set aside for p two right now they don't contain anything because my program just started i haven't gone to this new points out that all of the honest cetron so it says are okay now some local variables ominous set-aside space for your local variables now what are you going to do i'm going to say what i want to create that first point i'm going to call new if i'm calling new that's going to be a dynamic variable which means going to come from the heat so here's what happens i call this line icp one equals new points cucumber three so it says hey you're calling new you need some new memory that's dynamic memory i need to get up for you from the heat where did they keep start to keep starts up at the top and goes down white gate as associated with a point what values needing to start actually keep track of a point well-appointed incited as it's private executes private life so i have to set aside space for everything that a point in capsule eight which includes all of its private variables and it's public variables as well but all the instance variables get space allocated for them and they are some amount of overhead associate with the fact that we need to keep track of some extra information about this points object that you don't need to worry about the computer needs where you've got to their somehow overhead let's say there's four bytes for that for bikes for the entropy except for we are four bytes behavior api why which is why fancy memories going from bows in two thousand four two thousand eight so each one of the boxes appears not one bite i've discussed i like it to make it easier each box is not representing four bytes because integers or four bikes in the amount of overhead were keeping resistances or by phone but you don't need worry about and what did we do you want me called the constructor we set the private ecstatic equal to the value to the car passed and the private 