Today's Lesson: Pointers in C vs. Java. Hello, children, today we'll talk about pointers...
|
|
|
| | |
| ... usualy using pointer to an object. For example,.. Bob, come over here! Bob is the object and I'm a pointer Bob *Tyler. Now I can remotely manipulate Bob: Bob-StickFinger(Mouth); ... see? | |
| | |
|
|
|
|
...then about memory leaks...
|
|
|
| | |
| ...but what happens if we don't need Bob anymore? If I just stop pointing at Bob, let's say I start pointing somewhere else, Bob becomes a dangerous memory leak! Therefore we shall use ... | |
| | |
|
|
| | |
| memory leak at 0x00154a80 | |
| | |
|
|
|
...and Java garbage collection...
|
|
|
| | |
| In Java, removing or changing reference releases Bob, so he'll be automatically destroyed by garbage collection mechanism. Danny, come over here, youre the garbage collector! And so you see... | |
| | |
|
|
| | |
| Hey, Danny, stop it! Don't take the lesson THAT seriously! I said put the fucking hammer down! NOOO! | |
| | |
|
|
|